/[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 - (show annotations) (download)
Fri Jul 17 18:02:35 2015 UTC (2 weeks, 3 days 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 # Copyright 1999-2015 Gentoo Foundation
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.20 2015/06/17 19:23:34 grknight Exp $
4
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 # This eclass is no longer in use and scheduled to be removed on 2015-07-17
17 # @DEAD
18
19 # ========================================================================
20 # CFLAG SANITY
21 # ========================================================================
22
23 php_check_cflags() {
24 # Fixes bug #14067.
25 # Changed order to run it in reverse for bug #32022 and #12021.
26 replace-cpu-flags "k6*" "i586"
27 }
28
29 # ========================================================================
30 # IMAP SUPPORT
31 # ========================================================================
32
33 php_check_imap() {
34 if ! use "imap" && ! phpconfutils_usecheck "imap" ; then
35 return
36 fi
37
38 if use "ssl" || phpconfutils_usecheck "ssl" ; then
39 if ! built_with_use virtual/imap-c-client ssl ; then
40 eerror
41 eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!"
42 eerror
43 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 fi
52 fi
53
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 }
63
64 # ========================================================================
65 # JAVA EXTENSION SUPPORT
66 #
67 # 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
71 php_check_java() {
72 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
73 return
74 fi
75
76 JDKHOME="$(java-config --jdk-home)"
77 NOJDKERROR="You need to use the 'java-config' utility to set your JVM to a JDK!"
78 if [[ -z "${JDKHOME}" ]] || [[ ! -d "${JDKHOME}" ]] ; then
79 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 eerror " USE='-java-internal'"
93 eerror "in front of your emerge command, for example:"
94 eerror " USE='-java-internal' emerge =dev-lang/php-4*"
95 eerror
96 eerror "or edit your USE flags in /etc/portage/make.conf."
97 die "Kaffe JVM not supported"
98 fi
99
100 JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 }' | xargs )
101 einfo "Active JDK version: ${JDKVER}"
102 case "${JDKVER}" in
103 1.4.*) ;;
104 1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;;
105 *) eerror "A Java 1.4 JDK is recommended for Java support in PHP." ; die ;;
106 esac
107 }
108
109 php_install_java() {
110 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
111 return
112 fi
113
114 # We put these into /usr/lib so that they cannot conflict with
115 # other versions of PHP (e.g. PHP 4 & PHP 5)
116 insinto "${PHPEXTDIR}"
117
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 einfo "Installing JAR for PHP"
125 doins "ext/java/php_java.jar"
126
127 einfo "Installing Java test page"
128 newins "ext/java/except.php" "java-test.php"
129 }
130
131 php_install_java_inifile() {
132 if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
133 return
134 fi
135
136 JAVA_LIBRARY="$(grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;' | sort -u)"
137
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 # ========================================================================
147 # MTA SUPPORT
148 # ========================================================================
149
150 php_check_mta() {
151 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 }
161
162 # ========================================================================
163 # ORACLE SUPPORT
164 # ========================================================================
165
166 php_check_oracle_all() {
167 if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
168 eerror
169 eerror "You must have the ORACLE_HOME variable set in your environment to"
170 eerror "compile the Oracle extension."
171 eerror
172 die "Oracle configuration incorrect; user error"
173 fi
174
175 if use "oci8" || use "oracle7" ; then
176 if has_version 'dev-db/oracle-instantclient-basic' ; then
177 ewarn
178 ewarn "Please ensure you have a full install of the Oracle client."
179 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 fi
184 fi
185 }
186
187 php_check_oracle_8() {
188 if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
189 eerror
190 eerror "You must have the ORACLE_HOME variable set in your environment to"
191 eerror "compile the Oracle extension."
192 eerror
193 die "Oracle configuration incorrect; user error"
194 fi
195
196 if use "oci8" ; then
197 if has_version 'dev-db/oracle-instantclient-basic' ; then
198 ewarn
199 ewarn "Please ensure you have a full install of the Oracle client."
200 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 fi
205 fi
206 }
207
208 # ========================================================================
209 # POSTGRESQL SUPPORT
210 # ========================================================================
211
212 php_check_pgsql() {
213 if use "postgres" && use "apache2" && use "threads" ; then
214 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 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 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 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 fi
237 fi
238 }
239
240 # ========================================================================
241 # MYSQL CHARSET DETECTION SUPPORT ## Thanks to hoffie
242 # ========================================================================
243
244 php_get_mycnf_charset() {
245 # nothing todo if no mysql installed
246 if [[ ! -f "${ROOT}/etc/mysql/my.cnf" ]]; then
247 echo "empty"
248 return
249 fi
250 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