/[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.21 - (hide annotations) (download)
Fri Jul 17 18:02:35 2015 UTC (12 months, 1 week ago) by grknight
Branch: MAIN
CVS Tags: HEAD
Changes since 1.20: +1 -1 lines
FILE REMOVED
Drop old, unused eclasses wrt bug 551910

1 grknight 1.20 # Copyright 1999-2015 Gentoo Foundation
2 stuart 1.1 # Distributed under the terms of the GNU General Public License v2
3 grknight 1.21 # $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.20 2015/06/17 19:23:34 grknight Exp $
4 jokey 1.11
5     # Based on robbat2's work on the php4 sapi eclass
6     # Based on stuart's work on the php5 sapi eclass
7    
8     # @ECLASS: php-common-r1.eclass
9     # @MAINTAINER:
10     # Gentoo PHP team <php-bugs@gentoo.org>
11     # @BLURB: Common functions which are shared between the PHP4 and PHP5 packages.
12     # @DESCRIPTION:
13     # This eclass provides common functions which are shared between the PHP4 and PHP5 packages.
14     # It is only used by php*-sapi eclasses currently and the functions are not intended
15     # for direct use in ebuilds.
16 grknight 1.20 # This eclass is no longer in use and scheduled to be removed on 2015-07-17
17     # @DEAD
18 stuart 1.1
19 chtekk 1.9 # ========================================================================
20 stuart 1.1 # CFLAG SANITY
21 chtekk 1.9 # ========================================================================
22 stuart 1.1
23     php_check_cflags() {
24 chtekk 1.6 # Fixes bug #14067.
25     # Changed order to run it in reverse for bug #32022 and #12021.
26 jokey 1.13 replace-cpu-flags "k6*" "i586"
27 stuart 1.1 }
28    
29 chtekk 1.9 # ========================================================================
30 stuart 1.1 # IMAP SUPPORT
31 chtekk 1.9 # ========================================================================
32 stuart 1.1
33     php_check_imap() {
34 chtekk 1.9 if ! use "imap" && ! phpconfutils_usecheck "imap" ; then
35 stuart 1.1 return
36     fi
37    
38 chtekk 1.9 if use "ssl" || phpconfutils_usecheck "ssl" ; then
39 stuart 1.1 if ! built_with_use virtual/imap-c-client ssl ; then
40     eerror
41 chtekk 1.6 eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!"
42 stuart 1.1 eerror
43 chtekk 1.6 die "Please recompile the IMAP C-Client libraries with SSL support enabled"
44     fi
45     else
46     if built_with_use virtual/imap-c-client ssl ; then
47     eerror
48     eerror "IMAP without SSL requested, but your IMAP C-Client libraries are built with SSL!"
49     eerror
50     die "Please recompile the IMAP C-Client libraries with SSL support disabled"
51 stuart 1.1 fi
52     fi
53 jokey 1.13
54     if use "kolab" || phpconfutils_usecheck "kolab" ; then
55     if ! built_with_use net-libs/c-client kolab ; then
56     eerror
57     eerror "IMAP with annotations support requested, but net-libs/c-client is built without it!"
58     eerror
59     die "Please recompile net-libs/c-client with USE=kolab."
60     fi
61     fi
62 stuart 1.1 }
63    
64 chtekk 1.9 # ========================================================================
65 stuart 1.1 # JAVA EXTENSION SUPPORT
66     #
67 chtekk 1.9 # The bundled java extension is unique to PHP4, but there is
68     # now the PHP-Java-Bridge that works under both PHP4 and PHP5.
69     # ========================================================================
70 stuart 1.1
71 hollow 1.2 php_check_java() {
72 chtekk 1.9 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
73 chtekk 1.6 return
74 stuart 1.1 fi
75    
76 jokey 1.12 JDKHOME="$(java-config --jdk-home)"
77 chtekk 1.6 NOJDKERROR="You need to use the 'java-config' utility to set your JVM to a JDK!"
78     if [[ -z "${JDKHOME}" ]] || [[ ! -d "${JDKHOME}" ]] ; then
79 stuart 1.1 eerror "${NOJDKERROR}"
80     die "${NOJDKERROR}"
81     fi
82    
83     # stuart@gentoo.org - 2003/05/18
84     # Kaffe JVM is not a drop-in replacement for the Sun JDK at this time
85     if echo ${JDKHOME} | grep kaffe > /dev/null 2>&1 ; then
86     eerror
87     eerror "PHP will not build using the Kaffe Java Virtual Machine."
88     eerror "Please change your JVM to either Blackdown or Sun's."
89     eerror
90     eerror "To build PHP without Java support, please re-run this emerge"
91     eerror "and place the line:"
92 hollow 1.2 eerror " USE='-java-internal'"
93 chtekk 1.6 eerror "in front of your emerge command, for example:"
94 hollow 1.2 eerror " USE='-java-internal' emerge =dev-lang/php-4*"
95 stuart 1.1 eerror
96 zmedico 1.19 eerror "or edit your USE flags in /etc/portage/make.conf."
97 stuart 1.1 die "Kaffe JVM not supported"
98     fi
99    
100 hollow 1.2 JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 }' | xargs )
101 stuart 1.1 einfo "Active JDK version: ${JDKVER}"
102 chtekk 1.3 case "${JDKVER}" in
103 stuart 1.1 1.4.*) ;;
104     1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;;
105 chtekk 1.6 *) eerror "A Java 1.4 JDK is recommended for Java support in PHP." ; die ;;
106 stuart 1.1 esac
107     }
108    
109     php_install_java() {
110 chtekk 1.9 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
111 chtekk 1.6 return
112 stuart 1.1 fi
113    
114 chtekk 1.6 # We put these into /usr/lib so that they cannot conflict with
115 stuart 1.1 # other versions of PHP (e.g. PHP 4 & PHP 5)
116 chtekk 1.6 insinto "${PHPEXTDIR}"
117 chtekk 1.8
118     einfo "Installing PHP java extension"
119     doins "modules/java.so"
120    
121     einfo "Creating PHP java extension symlink"
122     dosym "${PHPEXTDIR}/java.so" "${PHPEXTDIR}/libphp_java.so"
123    
124 stuart 1.1 einfo "Installing JAR for PHP"
125 chtekk 1.6 doins "ext/java/php_java.jar"
126 stuart 1.1
127     einfo "Installing Java test page"
128 chtekk 1.6 newins "ext/java/except.php" "java-test.php"
129 stuart 1.1 }
130    
131 chtekk 1.3 php_install_java_inifile() {
132 chtekk 1.9 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
133 chtekk 1.6 return
134 chtekk 1.4 fi
135    
136 jokey 1.12 JAVA_LIBRARY="$(grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;' | sort -u)"
137 chtekk 1.3
138     echo "extension = java.so" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
139     echo "java.library = ${JAVA_LIBRARY}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
140     echo "java.class.path = ${PHPEXTDIR}/php_java.jar" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
141     echo "java.library.path = ${PHPEXTDIR}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
142    
143     dosym "${PHP_EXT_INI_DIR}/java.ini" "${PHP_EXT_INI_DIR_ACTIVE}/java.ini"
144     }
145    
146 chtekk 1.9 # ========================================================================
147 stuart 1.1 # MTA SUPPORT
148 chtekk 1.9 # ========================================================================
149 stuart 1.1
150     php_check_mta() {
151 chtekk 1.6 if ! [[ -x "${ROOT}/usr/sbin/sendmail" ]] ; then
152     ewarn
153     ewarn "You need a virtual/mta that provides a sendmail compatible binary!"
154     ewarn "All major MTAs provide this, and it's usually some symlink created"
155     ewarn "as '${ROOT}/usr/sbin/sendmail*'. You should also be able to use other"
156     ewarn "MTAs directly, but you'll have to edit the sendmail_path directive"
157     ewarn "in your php.ini for this to work."
158     ewarn
159     fi
160 stuart 1.1 }
161    
162 chtekk 1.9 # ========================================================================
163 stuart 1.1 # ORACLE SUPPORT
164 chtekk 1.9 # ========================================================================
165 stuart 1.1
166 chtekk 1.5 php_check_oracle_all() {
167 chtekk 1.9 if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
168 stuart 1.1 eerror
169 chtekk 1.6 eerror "You must have the ORACLE_HOME variable set in your environment to"
170     eerror "compile the Oracle extension."
171 stuart 1.1 eerror
172     die "Oracle configuration incorrect; user error"
173     fi
174    
175 chtekk 1.9 if use "oci8" || use "oracle7" ; then
176 stuart 1.1 if has_version 'dev-db/oracle-instantclient-basic' ; then
177 chtekk 1.6 ewarn
178 stuart 1.1 ewarn "Please ensure you have a full install of the Oracle client."
179 chtekk 1.6 ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient."
180     ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you"
181     ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client."
182     ewarn
183 stuart 1.1 fi
184     fi
185     }
186    
187 chtekk 1.5 php_check_oracle_8() {
188 chtekk 1.9 if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
189 chtekk 1.5 eerror
190 chtekk 1.6 eerror "You must have the ORACLE_HOME variable set in your environment to"
191     eerror "compile the Oracle extension."
192 chtekk 1.5 eerror
193     die "Oracle configuration incorrect; user error"
194     fi
195    
196 chtekk 1.9 if use "oci8" ; then
197 chtekk 1.5 if has_version 'dev-db/oracle-instantclient-basic' ; then
198 chtekk 1.6 ewarn
199 chtekk 1.5 ewarn "Please ensure you have a full install of the Oracle client."
200 chtekk 1.6 ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient."
201     ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you"
202     ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client."
203     ewarn
204 chtekk 1.5 fi
205     fi
206     }
207    
208 chtekk 1.9 # ========================================================================
209 chtekk 1.7 # POSTGRESQL SUPPORT
210 chtekk 1.9 # ========================================================================
211 chtekk 1.7
212     php_check_pgsql() {
213 hoffie 1.15 if use "postgres" && use "apache2" && use "threads" ; then
214 hoffie 1.16 if has_version dev-db/libpq ; then
215     if has_version ">=dev-db/libpq-8" && \
216     ! built_with_use ">=dev-db/libpq-8" "threads" ; then
217 hoffie 1.15 eerror
218     eerror "You must build dev-db/libpq with USE=threads"
219     eerror "if you want to build PHP with threads support!"
220     eerror
221     die "Rebuild dev-db/libpq with USE=threads"
222     fi
223     else
224     local pgsql_ver=$(eselect postgresql show)
225 scarabeus 1.17 if [[ ${pgsql_ver} == "(none)" ]]; then
226     eerror "QA: Please select your PostgreSQL version \"eselect postgresql list\""
227     die "Can't determine PgSQL."
228     fi
229 hoffie 1.15 if ! built_with_use "=dev-db/postgresql-base-${pgsql_ver}*" threads ; then
230     eerror
231     eerror "You must build =dev-db/postgresql-base-${pgsql_ver} with USE=threads"
232     eerror "if you want to build PHP with threads support!"
233     eerror
234     die "Rebuild =dev-db/postgresql-base-${pgsql_ver} with USE=threads"
235     fi
236 hoffie 1.14 fi
237 chtekk 1.7 fi
238     }
239    
240 chtekk 1.9 # ========================================================================
241     # MYSQL CHARSET DETECTION SUPPORT ## Thanks to hoffie
242     # ========================================================================
243    
244     php_get_mycnf_charset() {
245 jokey 1.10 # nothing todo if no mysql installed
246     if [[ ! -f "${ROOT}/etc/mysql/my.cnf" ]]; then
247     echo "empty"
248     return
249     fi
250 chtekk 1.9 local sapi="${1}"
251     local section=""
252     local client_charset=""
253     local sapi_charset=""
254    
255     # remove comments and pipe the output to our while loop
256     while read line ; do
257     line=$(echo "${line}" | sed 's:[;#][^\n]*::g')
258    
259     # skip empty lines
260     if [[ "${line}" == "" ]] ; then
261     continue
262     fi
263    
264     # capture sections
265     tmp=$(echo "${line}" | sed 's:\[\([-a-z0-9\_]*\)\]:\1:')
266     if [[ "${line}" != "${tmp}" ]] ; then
267     section=${tmp}
268     else
269     # we don't need to check lines which are not in a section we are interested about
270     if [[ "${section}" != "client" && "${section}" != "php-${sapi}" ]] ; then
271     continue
272     fi
273    
274     # match default-character-set= lines
275     tmp=$(echo "${line}" | sed 's|^[[:space:]\ ]*default-character-set[[:space:]\ ]*=[[:space:]\ ]*\"\?\([a-z0-9\-]*\)\"\?|\1|')
276     if [[ "${line}" == "${tmp}" ]] ; then
277     # nothing changed, irrelevant line
278     continue
279     fi
280     if [[ "${section}" == "client" ]] ; then
281     client_charset="${tmp}"
282     else
283     if [[ "${section}" == "php-${sapi}" ]] ; then
284     sapi_charset="${tmp}"
285     fi
286     fi
287     fi
288     done < "${ROOT}/etc/mysql/my.cnf"
289     # if a sapi-specific section with a default-character-set= value was found we use it, otherwise we use the client charset (which may be empty)
290     if [[ -n "${sapi_charset}" ]] ; then
291     echo "${sapi_charset}"
292     elif [[ -n "${client_charset}" ]] ; then
293     echo "${client_charset}"
294     else
295     echo "empty"
296     fi
297     }

  ViewVC Help
Powered by ViewVC 1.1.20