| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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/depend.apache.eclass,v 1.43 2008/02/06 23:45:13 hollow Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.44 2008/03/04 10:59:27 hollow Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: depend.apache.eclass |
5 | # @ECLASS: depend.apache.eclass |
|
|
6 | # @MAINTAINER: |
| 6 | # @MAINTAINER: apache-devs@gentoo.org |
7 | # apache-devs@gentoo.org |
| 7 | # @BLURB: Functions to allow ebuilds to depend on apache |
8 | # @BLURB: Functions to allow ebuilds to depend on apache |
| 8 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 9 | # This eclass handles depending on apache in a sane way and provides information |
10 | # This eclass handles depending on apache in a sane way and provides information |
| 10 | # about where certain binaries and configuration files are located. |
11 | # about where certain binaries and configuration files are located. |
| 11 | # |
12 | # |
| … | |
… | |
| 19 | # @EXAMPLE: |
20 | # @EXAMPLE: |
| 20 | # |
21 | # |
| 21 | # Here is an example of an ebuild depending on apache: |
22 | # Here is an example of an ebuild depending on apache: |
| 22 | # |
23 | # |
| 23 | # @CODE |
24 | # @CODE |
| 24 | # DEPEND="virtual/Perl-CGI" |
25 | # DEPEND="virtual/Perl-CGI" |
| 25 | # RDEPEND="${DEPEND}" |
26 | # RDEPEND="${DEPEND}" |
| 26 | # need_apache2 |
27 | # need_apache2 |
| 27 | # @CODE |
28 | # @CODE |
| 28 | # |
29 | # |
| 29 | # Another example which demonstrates non-standard IUSE options for optional |
30 | # Another example which demonstrates non-standard IUSE options for optional |
| 30 | # apache support: |
31 | # apache support: |
| 31 | # |
32 | # |
| 32 | # @CODE |
33 | # @CODE |
| 33 | # DEPEND="server? ( virtual/Perl-CGI )" |
34 | # DEPEND="server? ( virtual/Perl-CGI )" |
| 34 | # RDEPEND="${DEPEND}" |
35 | # RDEPEND="${DEPEND}" |
| 35 | # want_apache2 server |
36 | # want_apache2 server |
| 36 | # @CODE |
37 | # @CODE |
| 37 | |
38 | |
| 38 | inherit multilib |
39 | inherit multilib |
| 39 | |
40 | |
| 40 | # ============================================================================== |
41 | # ============================================================================== |
| … | |
… | |
| 152 | local myiuse=${1:-apache2} |
153 | local myiuse=${1:-apache2} |
| 153 | IUSE="${IUSE} ${myiuse}" |
154 | IUSE="${IUSE} ${myiuse}" |
| 154 | DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
155 | DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
| 155 | RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
156 | RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
| 156 | |
157 | |
| 157 | if use ${myiuse} ; then |
158 | if use ${myiuse}; then |
| 158 | _init_apache2 |
159 | _init_apache2 |
| 159 | else |
160 | else |
| 160 | _init_no_apache |
161 | _init_no_apache |
| 161 | fi |
162 | fi |
| 162 | } |
163 | } |
| … | |
… | |
| 173 | local myiuse=${1:-apache2} |
174 | local myiuse=${1:-apache2} |
| 174 | IUSE="${IUSE} ${myiuse}" |
175 | IUSE="${IUSE} ${myiuse}" |
| 175 | DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
176 | DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
| 176 | RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
177 | RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
| 177 | |
178 | |
| 178 | if use ${myiuse} ; then |
179 | if use ${myiuse}; then |
| 179 | _init_apache2 |
180 | _init_apache2 |
| 180 | else |
181 | else |
| 181 | _init_no_apache |
182 | _init_no_apache |
| 182 | fi |
183 | fi |
| 183 | } |
184 | } |
| … | |
… | |
| 208 | debug-print-function $FUNCNAME $* |
209 | debug-print-function $FUNCNAME $* |
| 209 | |
210 | |
| 210 | DEPEND="${DEPEND} ${APACHE2_2_DEPEND}" |
211 | DEPEND="${DEPEND} ${APACHE2_2_DEPEND}" |
| 211 | RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}" |
212 | RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}" |
| 212 | _init_apache2 |
213 | _init_apache2 |
|
|
214 | } |
|
|
215 | |
|
|
216 | # @FUNCTION: has_apache |
|
|
217 | # @DESCRIPTION: |
|
|
218 | # An ebuild calls this to get runtime variables for an indirect apache |
|
|
219 | # dependency without USE-flag, in which case want_apache does not work. |
|
|
220 | # DO NOT call this function in global scope. |
|
|
221 | has_apache() { |
|
|
222 | debug-print-function $FUNCNAME $* |
|
|
223 | |
|
|
224 | if has_version '>=www-servers/apache-2'; then |
|
|
225 | _init_apache2 |
|
|
226 | else |
|
|
227 | _init_no_apache |
|
|
228 | fi |
| 213 | } |
229 | } |
| 214 | |
230 | |
| 215 | # @FUNCTION: has_apache_threads |
231 | # @FUNCTION: has_apache_threads |
| 216 | # @USAGE: [myflag] |
232 | # @USAGE: [myflag] |
| 217 | # @DESCRIPTION: |
233 | # @DESCRIPTION: |
| … | |
… | |
| 219 | # built with a threaded MPM. If the myflag parameter is not given it defaults to |
235 | # built with a threaded MPM. If the myflag parameter is not given it defaults to |
| 220 | # threads. |
236 | # threads. |
| 221 | has_apache_threads() { |
237 | has_apache_threads() { |
| 222 | debug-print-function $FUNCNAME $* |
238 | debug-print-function $FUNCNAME $* |
| 223 | |
239 | |
| 224 | if ! built_with_use www-servers/apache threads ; then |
240 | if ! built_with_use www-servers/apache threads; then |
| 225 | return |
241 | return |
| 226 | fi |
242 | fi |
| 227 | |
243 | |
| 228 | local myflag="${1:-threads}" |
244 | local myflag="${1:-threads}" |
| 229 | |
245 | |
| 230 | if ! use ${myflag} ; then |
246 | if ! use ${myflag}; then |
| 231 | echo |
247 | echo |
| 232 | eerror "You need to enable USE flag '${myflag}' to build a thread-safe version" |
248 | eerror "You need to enable USE flag '${myflag}' to build a thread-safe version" |
| 233 | eerror "of ${CATEGORY}/${PN} for use with www-servers/apache" |
249 | eerror "of ${CATEGORY}/${PN} for use with www-servers/apache" |
| 234 | die "Need missing USE flag '${myflag}'" |
250 | die "Need missing USE flag '${myflag}'" |
| 235 | fi |
251 | fi |
| … | |
… | |
| 242 | # package if apache has been built with a threaded MPM. If the myflag parameter |
258 | # package if apache has been built with a threaded MPM. If the myflag parameter |
| 243 | # is not given it defaults to threads. |
259 | # is not given it defaults to threads. |
| 244 | has_apache_threads_in() { |
260 | has_apache_threads_in() { |
| 245 | debug-print-function $FUNCNAME $* |
261 | debug-print-function $FUNCNAME $* |
| 246 | |
262 | |
| 247 | if ! built_with_use www-servers/apache threads ; then |
263 | if ! built_with_use www-servers/apache threads; then |
| 248 | return |
264 | return |
| 249 | fi |
265 | fi |
| 250 | |
266 | |
| 251 | local myforeign="$1" |
267 | local myforeign="$1" |
| 252 | local myflag="${2:-threads}" |
268 | local myflag="${2:-threads}" |
| 253 | |
269 | |
| 254 | if ! built_with_use ${myforeign} ${myflag} ; then |
270 | if ! built_with_use ${myforeign} ${myflag}; then |
| 255 | echo |
271 | echo |
| 256 | eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" |
272 | eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" |
| 257 | eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" |
273 | eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" |
| 258 | eerror "with www-servers/apache" |
274 | eerror "with www-servers/apache" |
| 259 | die "Need missing USE flag '${myflag}' in ${myforeign}" |
275 | die "Need missing USE flag '${myflag}' in ${myforeign}" |