/[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.45
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2009 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.45 2009/05/26 16:41:56 arfrever 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# ==============================================================================
129 134
130# ============================================================================== 135# ==============================================================================
131# PUBLIC FUNCTIONS 136# PUBLIC FUNCTIONS
132# ============================================================================== 137# ==============================================================================
133 138
139# @FUNCTION: depend.apache_pkg_setup
140# @USAGE: [myiuse]
141# @DESCRIPTION:
142# An ebuild calls this in pkg_setup() to initialize variables for optional
143# apache-2.x support. If the myiuse parameter is not given it defaults to
144# apache2.
145depend.apache_pkg_setup() {
146 debug-print-function $FUNCNAME $*
147
148 if [[ "${EBUILD_PHASE}" != "setup" ]]; then
149 die "$FUNCNAME() should be called in pkg_setup()"
150 fi
151
152 local myiuse=${1:-apache2}
153 if has ${myiuse} ${IUSE}; then
154 if use ${myiuse}; then
155 _init_apache2
156 else
157 _init_no_apache
158 fi
159 fi
160}
161
134# @FUNCTION: want_apache 162# @FUNCTION: want_apache
135# @USAGE: [myiuse] 163# @USAGE: [myiuse]
136# @DESCRIPTION: 164# @DESCRIPTION:
137# An ebuild calls this to get the dependency information for optional apache 165# 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. 166# support. If the myiuse parameter is not given it defaults to apache2.
167# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
168# with the same myiuse parameter.
139want_apache() { 169want_apache() {
140 debug-print-function $FUNCNAME $* 170 debug-print-function $FUNCNAME $*
141 want_apache2 "$@" 171 want_apache2 "$@"
142} 172}
143 173
144# @FUNCTION: want_apache2 174# @FUNCTION: want_apache2
145# @USAGE: [myiuse] 175# @USAGE: [myiuse]
146# @DESCRIPTION: 176# @DESCRIPTION:
147# An ebuild calls this to get the dependency information for optional apache-2.x 177# 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. 178# support. If the myiuse parameter is not given it defaults to apache2.
179# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
180# with the same myiuse parameter.
149want_apache2() { 181want_apache2() {
150 debug-print-function $FUNCNAME $* 182 debug-print-function $FUNCNAME $*
151 183
152 local myiuse=${1:-apache2} 184 local myiuse=${1:-apache2}
153 IUSE="${IUSE} ${myiuse}" 185 IUSE="${IUSE} ${myiuse}"
154 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 186 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
155 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 187 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
156
157 if use ${myiuse} ; then
158 _init_apache2
159 else
160 _init_no_apache
161 fi
162} 188}
163 189
164# @FUNCTION: want_apache2_2 190# @FUNCTION: want_apache2_2
165# @USAGE: [myiuse] 191# @USAGE: [myiuse]
166# @DESCRIPTION: 192# @DESCRIPTION:
167# An ebuild calls this to get the dependency information for optional 193# 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 194# apache-2.2.x support. If the myiuse parameter is not given it defaults to
169# apache2. 195# apache2.
196# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
197# with the same myiuse parameter.
170want_apache2_2() { 198want_apache2_2() {
171 debug-print-function $FUNCNAME $* 199 debug-print-function $FUNCNAME $*
172 200
173 local myiuse=${1:-apache2} 201 local myiuse=${1:-apache2}
174 IUSE="${IUSE} ${myiuse}" 202 IUSE="${IUSE} ${myiuse}"
175 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 203 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
176 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 204 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
205}
177 206
178 if use ${myiuse} ; then 207# @FUNCTION: need_apache
208# @DESCRIPTION:
209# An ebuild calls this to get the dependency information for apache.
210need_apache() {
211 debug-print-function $FUNCNAME $*
212 need_apache2
213}
214
215# @FUNCTION: need_apache2
216# @DESCRIPTION:
217# An ebuild calls this to get the dependency information for apache-2.x.
218need_apache2() {
219 debug-print-function $FUNCNAME $*
220
221 DEPEND="${DEPEND} ${APACHE2_DEPEND}"
222 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
223 _init_apache2
224}
225
226# @FUNCTION: need_apache2_2
227# @DESCRIPTION:
228# An ebuild calls this to get the dependency information for apache-2.2.x.
229need_apache2_2() {
230 debug-print-function $FUNCNAME $*
231
232 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
233 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
234 _init_apache2
235}
236
237# @FUNCTION: has_apache
238# @DESCRIPTION:
239# An ebuild calls this to get runtime variables for an indirect apache
240# dependency without USE-flag, in which case want_apache does not work.
241# DO NOT call this function in global scope.
242has_apache() {
243 debug-print-function $FUNCNAME $*
244
245 if has_version '>=www-servers/apache-2'; then
179 _init_apache2 246 _init_apache2
180 else 247 else
181 _init_no_apache 248 _init_no_apache
182 fi 249 fi
183} 250}
184 251
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 252# @FUNCTION: has_apache_threads
216# @USAGE: [myflag] 253# @USAGE: [myflag]
217# @DESCRIPTION: 254# @DESCRIPTION:
218# An ebuild calls this to make sure thread-safety is enabled if apache has been 255# 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 256# built with a threaded MPM. If the myflag parameter is not given it defaults to
220# threads. 257# threads.
221check_apache_threads() { 258has_apache_threads() {
222 debug-print-function $FUNCNAME $* 259 debug-print-function $FUNCNAME $*
223 260
224 if ! built_with_use www-servers/apache threads ; then 261 if ! built_with_use www-servers/apache threads; then
225 return 262 return
226 fi 263 fi
227 264
228 local myflag="${1:-threads}" 265 local myflag="${1:-threads}"
229 266
230 if ! use ${myflag} ; then 267 if ! use ${myflag}; then
231 echo 268 echo
232 eerror "You need to enable USE flag '${myflag}' to build a thread-safe version" 269 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" 270 eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
234 die "Need missing USE flag '${myflag}'" 271 die "Need missing USE flag '${myflag}'"
235 fi 272 fi
236} 273}
237 274
238# @FUNCTION: check_apache_threads_in 275# @FUNCTION: has_apache_threads_in
239# @USAGE: <myforeign> [myflag] 276# @USAGE: <myforeign> [myflag]
240# @DESCRIPTION: 277# @DESCRIPTION:
241# An ebuild calls this to make sure thread-safety is enabled in a foreign 278# 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 279# package if apache has been built with a threaded MPM. If the myflag parameter
243# is not given it defaults to threads. 280# is not given it defaults to threads.
244check_apache_threads_in() { 281has_apache_threads_in() {
245 debug-print-function $FUNCNAME $* 282 debug-print-function $FUNCNAME $*
246 283
247 if ! built_with_use www-servers/apache threads ; then 284 if ! built_with_use www-servers/apache threads; then
248 return 285 return
249 fi 286 fi
250 287
251 local myforeign="$1" 288 local myforeign="$1"
252 local myflag="${2:-threads}" 289 local myflag="${2:-threads}"
253 290
254 if ! built_with_use ${myforeign} ${myflag} ; then 291 if ! built_with_use ${myforeign} ${myflag}; then
255 echo 292 echo
256 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" 293 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
257 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" 294 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
258 eerror "with www-servers/apache" 295 eerror "with www-servers/apache"
259 die "Need missing USE flag '${myflag}' in ${myforeign}" 296 die "Need missing USE flag '${myflag}' in ${myforeign}"
260 fi 297 fi
261} 298}
299
300EXPORT_FUNCTIONS pkg_setup

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

  ViewVC Help
Powered by ViewVC 1.1.20