/[gentoo-x86]/eclass/depend.apache.eclass
Gentoo

Diff of /eclass/depend.apache.eclass

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

Revision 1.42 Revision 1.46
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2012 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.42 2008/02/06 21:20:41 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.46 2012/04/20 07:19:49 patrick 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
37#
38# pkg_setup() {
39# depend.apache_pkg_setup server
40# }
36# @CODE 41# @CODE
37 42
38inherit multilib 43inherit multilib
39 44
40# ============================================================================== 45# ==============================================================================
98 103
99# @ECLASS-VARIABLE: APACHE2_2_DEPEND 104# @ECLASS-VARIABLE: APACHE2_2_DEPEND
100# @DESCRIPTION: 105# @DESCRIPTION:
101# Dependencies for Apache 2.2.x 106# Dependencies for Apache 2.2.x
102APACHE2_2_DEPEND="=www-servers/apache-2.2*" 107APACHE2_2_DEPEND="=www-servers/apache-2.2*"
108
109# @ECLASS-VARIABLE: APACHE2_4_DEPEND
110# @DESCRIPTION:
111# Dependencies for Apache 2.4.x
112APACHE2_2_DEPEND="=www-servers/apache-2.4*"
113
103 114
104# ============================================================================== 115# ==============================================================================
105# INTERNAL FUNCTIONS 116# INTERNAL FUNCTIONS
106# ============================================================================== 117# ==============================================================================
107 118
129 140
130# ============================================================================== 141# ==============================================================================
131# PUBLIC FUNCTIONS 142# PUBLIC FUNCTIONS
132# ============================================================================== 143# ==============================================================================
133 144
145# @FUNCTION: depend.apache_pkg_setup
146# @USAGE: [myiuse]
147# @DESCRIPTION:
148# An ebuild calls this in pkg_setup() to initialize variables for optional
149# apache-2.x support. If the myiuse parameter is not given it defaults to
150# apache2.
151depend.apache_pkg_setup() {
152 debug-print-function $FUNCNAME $*
153
154 if [[ "${EBUILD_PHASE}" != "setup" ]]; then
155 die "$FUNCNAME() should be called in pkg_setup()"
156 fi
157
158 local myiuse=${1:-apache2}
159 if has ${myiuse} ${IUSE}; then
160 if use ${myiuse}; then
161 _init_apache2
162 else
163 _init_no_apache
164 fi
165 fi
166}
167
134# @FUNCTION: want_apache 168# @FUNCTION: want_apache
135# @USAGE: [myiuse] 169# @USAGE: [myiuse]
136# @DESCRIPTION: 170# @DESCRIPTION:
137# An ebuild calls this to get the dependency information for optional apache 171# An ebuild calls this to get the dependency information for optional apache
138# support. If the myiuse parameter is not given it defaults to apache2. 172# support. If the myiuse parameter is not given it defaults to apache2.
173# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
174# with the same myiuse parameter.
139want_apache() { 175want_apache() {
140 debug-print-function $FUNCNAME $* 176 debug-print-function $FUNCNAME $*
141 want_apache2 "$@" 177 want_apache2 "$@"
142} 178}
143 179
144# @FUNCTION: want_apache2 180# @FUNCTION: want_apache2
145# @USAGE: [myiuse] 181# @USAGE: [myiuse]
146# @DESCRIPTION: 182# @DESCRIPTION:
147# An ebuild calls this to get the dependency information for optional apache-2.x 183# An ebuild calls this to get the dependency information for optional apache-2.x
148# support. If the myiuse parameter is not given it defaults to apache2. 184# support. If the myiuse parameter is not given it defaults to apache2.
185# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
186# with the same myiuse parameter.
149want_apache2() { 187want_apache2() {
150 debug-print-function $FUNCNAME $* 188 debug-print-function $FUNCNAME $*
151 189
152 local myiuse=${1:-apache2} 190 local myiuse=${1:-apache2}
153 IUSE="${IUSE} ${myiuse}" 191 IUSE="${IUSE} ${myiuse}"
154 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 192 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
155 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 193 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
156
157 if use ${myiuse} ; then
158 _init_apache2
159 else
160 _init_no_apache
161 fi
162} 194}
163 195
164# @FUNCTION: want_apache2_2 196# @FUNCTION: want_apache2_2
165# @USAGE: [myiuse] 197# @USAGE: [myiuse]
166# @DESCRIPTION: 198# @DESCRIPTION:
167# An ebuild calls this to get the dependency information for optional 199# An ebuild calls this to get the dependency information for optional
168# apache-2.2.x support. If the myiuse parameter is not given it defaults to 200# apache-2.2.x support. If the myiuse parameter is not given it defaults to
169# apache2. 201# apache2.
202# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
203# with the same myiuse parameter.
170want_apache2_2() { 204want_apache2_2() {
171 debug-print-function $FUNCNAME $* 205 debug-print-function $FUNCNAME $*
172 206
173 local myiuse=${1:-apache2} 207 local myiuse=${1:-apache2}
174 IUSE="${IUSE} ${myiuse}" 208 IUSE="${IUSE} ${myiuse}"
175 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 209 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
176 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 210 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
211}
177 212
178 if use ${myiuse} ; then 213# @FUNCTION: need_apache
214# @DESCRIPTION:
215# An ebuild calls this to get the dependency information for apache.
216need_apache() {
217 debug-print-function $FUNCNAME $*
218 need_apache2
219}
220
221# @FUNCTION: need_apache2
222# @DESCRIPTION:
223# An ebuild calls this to get the dependency information for apache-2.x.
224need_apache2() {
225 debug-print-function $FUNCNAME $*
226
227 DEPEND="${DEPEND} ${APACHE2_DEPEND}"
228 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
229 _init_apache2
230}
231
232# @FUNCTION: need_apache2_2
233# @DESCRIPTION:
234# An ebuild calls this to get the dependency information for apache-2.2.x.
235need_apache2_2() {
236 debug-print-function $FUNCNAME $*
237
238 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
239 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
240 _init_apache2
241}
242
243# @FUNCTION: need_apache2_4
244# @DESCRIPTION:
245# An ebuild calls this to get the dependency information for apache-2.4.x.
246need_apache2_4() {
247 debug-print-function $FUNCNAME $*
248
249 DEPEND="${DEPEND} ${APACHE2_4_DEPEND}"
250 RDEPEND="${RDEPEND} ${APACHE2_4_DEPEND}"
251 _init_apache2
252}
253
254# @FUNCTION: has_apache
255# @DESCRIPTION:
256# An ebuild calls this to get runtime variables for an indirect apache
257# dependency without USE-flag, in which case want_apache does not work.
258# DO NOT call this function in global scope.
259has_apache() {
260 debug-print-function $FUNCNAME $*
261
262 if has_version '>=www-servers/apache-2'; then
179 _init_apache2 263 _init_apache2
180 else 264 else
181 _init_no_apache 265 _init_no_apache
182 fi 266 fi
183} 267}
184 268
185# @FUNCTION: need_apache
186# @DESCRIPTION:
187# An ebuild calls this to get the dependency information for apache.
188need_apache() {
189 debug-print-function $FUNCNAME $*
190 need_apache2
191}
192
193# @FUNCTION: need_apache2
194# @DESCRIPTION:
195# An ebuild calls this to get the dependency information for apache-2.x.
196need_apache2() {
197 debug-print-function $FUNCNAME $*
198
199 DEPEND="${DEPEND} ${APACHE2_DEPEND}"
200 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
201 _init_apache2
202}
203
204# @FUNCTION: need_apache2_2
205# @DESCRIPTION:
206# An ebuild calls this to get the dependency information for apache-2.2.x.
207need_apache2_2() {
208 debug-print-function $FUNCNAME $*
209
210 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
211 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
212 _init_apache2
213}
214
215# @FUNCTION: check_apache_threads 269# @FUNCTION: has_apache_threads
216# @USAGE: [myflag] 270# @USAGE: [myflag]
217# @DESCRIPTION: 271# @DESCRIPTION:
218# An ebuild calls this to make sure thread-safety is enabled if apache has been 272# An ebuild calls this to make sure thread-safety is enabled if apache has been
219# built with a threaded MPM. If the myflag parameter is not given it defaults to 273# built with a threaded MPM. If the myflag parameter is not given it defaults to
220# threads. 274# threads.
221check_apache_threads() { 275has_apache_threads() {
222 debug-print-function $FUNCNAME $* 276 debug-print-function $FUNCNAME $*
223 277
224 if ! built_with_use www-servers/apache threads ; then 278 if ! built_with_use www-servers/apache threads; then
225 return 279 return
226 fi 280 fi
227 281
228 local myflag="${1:-threads}" 282 local myflag="${1:-threads}"
229 283
230 if ! use ${myflag} ; then 284 if ! use ${myflag}; then
231 echo 285 echo
232 eerror "You need to enable USE flag '${myflag}' to build a thread-safe version" 286 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" 287 eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
234 die "Need missing USE flag '${myflag}'" 288 die "Need missing USE flag '${myflag}'"
235 fi 289 fi
236} 290}
237 291
238# @FUNCTION: check_apache_threads_in 292# @FUNCTION: has_apache_threads_in
239# @USAGE: <myforeign> [myflag] 293# @USAGE: <myforeign> [myflag]
240# @DESCRIPTION: 294# @DESCRIPTION:
241# An ebuild calls this to make sure thread-safety is enabled in a foreign 295# An ebuild calls this to make sure thread-safety is enabled in a foreign
242# package if apache has been built with a threaded MPM. If the myflag parameter 296# package if apache has been built with a threaded MPM. If the myflag parameter
243# is not given it defaults to threads. 297# is not given it defaults to threads.
244check_apache_threads_in() { 298has_apache_threads_in() {
245 debug-print-function $FUNCNAME $* 299 debug-print-function $FUNCNAME $*
246 300
247 if ! built_with_use www-servers/apache threads ; then 301 if ! built_with_use www-servers/apache threads; then
248 return 302 return
249 fi 303 fi
250 304
251 local myforeign="$1" 305 local myforeign="$1"
252 local myflag="${2:-threads}" 306 local myflag="${2:-threads}"
253 307
254 if ! built_with_use ${myforeign} ${myflag} ; then 308 if ! built_with_use ${myforeign} ${myflag}; then
255 echo 309 echo
256 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" 310 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
257 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" 311 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
258 eerror "with www-servers/apache" 312 eerror "with www-servers/apache"
259 die "Need missing USE flag '${myflag}' in ${myforeign}" 313 die "Need missing USE flag '${myflag}' in ${myforeign}"
260 fi 314 fi
261} 315}
316
317EXPORT_FUNCTIONS pkg_setup

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.20