/[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.39 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.39 2008/02/03 14:12:44 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 providing 10# This eclass handles depending on apache in a sane way and provides information
10# information about where certain interfaces are located. 11# about where certain binaries and configuration files are located.
11# 12#
12# @NOTE: If you use this, be sure you use the need_* call after you have defined 13# To make use of this eclass simply call one of the need/want_apache functions
14# described below. Make sure you use the need/want_apache call after you have
13# DEPEND and RDEPEND. Also note that you can not rely on the automatic 15# defined DEPEND and RDEPEND. Also note that you can not rely on the automatic
14# RDEPEND=DEPEND that portage does if you use this eclass. 16# RDEPEND=DEPEND that portage does if you use this eclass.
15# 17#
16# See bug 107127 for more information. 18# See Bug 107127 for more information.
19#
20# @EXAMPLE:
21#
22# Here is an example of an ebuild depending on apache:
23#
24# @CODE
25# DEPEND="virtual/Perl-CGI"
26# RDEPEND="${DEPEND}"
27# need_apache2
28# @CODE
29#
30# Another example which demonstrates non-standard IUSE options for optional
31# apache support:
32#
33# @CODE
34# DEPEND="server? ( virtual/Perl-CGI )"
35# RDEPEND="${DEPEND}"
36# want_apache2 server
37#
38# pkg_setup() {
39# depend.apache_pkg_setup server
40# }
41# @CODE
17 42
18inherit multilib 43inherit multilib
19 44
20# ============================================================================== 45# ==============================================================================
21# INTERNAL VARIABLES 46# INTERNAL VARIABLES
22# ============================================================================== 47# ==============================================================================
23 48
24# @ECLASS-VARIABLE: APACHE_VERSION 49# @ECLASS-VARIABLE: APACHE_VERSION
25# @DESCRIPTION: 50# @DESCRIPTION:
26# Stores the version of apache we are going to be ebuilding. This variable is 51# Stores the version of apache we are going to be ebuilding.
27# set by the need_apache functions. 52# This variable is set by the want/need_apache functions.
28 53
29# @ECLASS-VARIABLE: APXS 54# @ECLASS-VARIABLE: APXS
30# @DESCRIPTION: 55# @DESCRIPTION:
31# Paths to the apxs tool 56# Path to the apxs tool.
57# This variable is set by the want/need_apache functions.
32 58
59# @ECLASS-VARIABLE: APACHE_BIN
60# @DESCRIPTION:
61# Path to the apache binary.
62# This variable is set by the want/need_apache functions.
63
33# @ECLASS-VARIABLE: APACHECTL 64# @ECLASS-VARIABLE: APACHE_CTL
34# @DESCRIPTION: 65# @DESCRIPTION:
35# Path to the apachectl tool 66# Path to the apachectl tool.
67# This variable is set by the want/need_apache functions.
36 68
37# @ECLASS-VARIABLE: APACHE_BASEDIR 69# @ECLASS-VARIABLE: APACHE_BASEDIR
38# @DESCRIPTION: 70# @DESCRIPTION:
39# Path to the server root directory 71# Path to the server root directory.
72# This variable is set by the want/need_apache functions.
40 73
41# @ECLASS-VARIABLE: APACHE_CONFDIR 74# @ECLASS-VARIABLE: APACHE_CONFDIR
42# @DESCRIPTION: 75# @DESCRIPTION:
43# Path to the configuration file directory 76# Path to the configuration file directory.
77# This variable is set by the want/need_apache functions.
44 78
45# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR 79# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR
46# @DESCRIPTION: 80# @DESCRIPTION:
47# Path where module configuration files are kept 81# Path where module configuration files are kept.
82# This variable is set by the want/need_apache functions.
48 83
49# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR 84# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR
50# @DESCRIPTION: 85# @DESCRIPTION:
51# Path where virtual host configuration files are kept 86# Path where virtual host configuration files are kept.
87# This variable is set by the want/need_apache functions.
52 88
53# @ECLASS-VARIABLE: APACHE_MODULESDIR 89# @ECLASS-VARIABLE: APACHE_MODULESDIR
54# @DESCRIPTION: 90# @DESCRIPTION:
55# Path where we install modules 91# Path where we install modules.
92# This variable is set by the want/need_apache functions.
56 93
57# @ECLASS-VARIABLE: APACHE_DEPEND 94# @ECLASS-VARIABLE: APACHE_DEPEND
58# @DESCRIPTION: 95# @DESCRIPTION:
59# Dependencies for Apache 96# Dependencies for Apache
60APACHE_DEPEND="www-servers/apache" 97APACHE_DEPEND="www-servers/apache"
80 # into the dependency cache (DEPEND/RDEPEND/etc) 117 # into the dependency cache (DEPEND/RDEPEND/etc)
81 APACHE_VERSION="2" 118 APACHE_VERSION="2"
82 APXS="/usr/sbin/apxs2" 119 APXS="/usr/sbin/apxs2"
83 APACHE_BIN="/usr/sbin/apache2" 120 APACHE_BIN="/usr/sbin/apache2"
84 APACHE_CTL="/usr/sbin/apache2ctl" 121 APACHE_CTL="/usr/sbin/apache2ctl"
85 # legacy alias 122 APACHE_INCLUDEDIR="/usr/include/apache2"
86 APACHECTL="${APACHE_CTL}"
87 APACHE_BASEDIR="/usr/$(get_libdir)/apache2" 123 APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
88 APACHE_CONFDIR="/etc/apache2" 124 APACHE_CONFDIR="/etc/apache2"
89 APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d" 125 APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
90 APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d" 126 APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
91 APACHE_MODULESDIR="${APACHE_BASEDIR}/modules" 127 APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
98 134
99# ============================================================================== 135# ==============================================================================
100# PUBLIC FUNCTIONS 136# PUBLIC FUNCTIONS
101# ============================================================================== 137# ==============================================================================
102 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
103# @FUNCTION: want_apache 162# @FUNCTION: want_apache
163# @USAGE: [myiuse]
164# @DESCRIPTION:
165# An ebuild calls this to get the dependency information for optional apache
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.
169want_apache() {
170 debug-print-function $FUNCNAME $*
171 want_apache2 "$@"
172}
173
174# @FUNCTION: want_apache2
175# @USAGE: [myiuse]
104# @DESCRIPTION: 176# @DESCRIPTION:
105# 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
106# support. 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.
107want_apache2() { 181want_apache2() {
108 debug-print-function $FUNCNAME $* 182 debug-print-function $FUNCNAME $*
109 183
110 local myiuse=${1:-apache2} 184 local myiuse=${1:-apache2}
111 IUSE="${IUSE} ${myiuse}" 185 IUSE="${IUSE} ${myiuse}"
112 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 186 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
113 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 187 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
114
115 if use ${myiuse} ; then
116 _init_apache2
117 else
118 _init_no_apache
119 fi
120} 188}
121 189
122# @FUNCTION: want_apache 190# @FUNCTION: want_apache2_2
191# @USAGE: [myiuse]
123# @DESCRIPTION: 192# @DESCRIPTION:
124# An ebuild calls this to get the dependency information for optional 193# An ebuild calls this to get the dependency information for optional
125# apache-2.2.x support. 194# apache-2.2.x support. If the myiuse parameter is not given it defaults to
195# apache2.
196# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
197# with the same myiuse parameter.
126want_apache2_2() { 198want_apache2_2() {
127 debug-print-function $FUNCNAME $* 199 debug-print-function $FUNCNAME $*
128 200
129 local myiuse=${1:-apache2} 201 local myiuse=${1:-apache2}
130 IUSE="${IUSE} ${myiuse}" 202 IUSE="${IUSE} ${myiuse}"
131 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 203 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
132 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 204 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
205}
133 206
134 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
135 _init_apache2 246 _init_apache2
136 else 247 else
137 _init_no_apache 248 _init_no_apache
138 fi 249 fi
139} 250}
140 251
141# @FUNCTION: want_apache 252# @FUNCTION: has_apache_threads
253# @USAGE: [myflag]
142# @DESCRIPTION: 254# @DESCRIPTION:
143# An ebuild calls this to get the dependency information for optional apache 255# An ebuild calls this to make sure thread-safety is enabled if apache has been
144# support. 256# built with a threaded MPM. If the myflag parameter is not given it defaults to
145want_apache() { 257# threads.
258has_apache_threads() {
146 debug-print-function $FUNCNAME $* 259 debug-print-function $FUNCNAME $*
147 want_apache2 "$@"
148}
149 260
150# @FUNCTION: need_apache2 261 if ! built_with_use www-servers/apache threads; then
151# @DESCRIPTION: 262 return
152# Works like need_apache, but its used by modules that only support 263 fi
153# apache 2.x and do not work with other versions.
154need_apache2() {
155 debug-print-function $FUNCNAME $*
156 264
157 DEPEND="${DEPEND} ${APACHE2_DEPEND}" 265 local myflag="${1:-threads}"
158 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
159 _init_apache2
160}
161 266
162# @FUNCTION: need_apache2_2 267 if ! use ${myflag}; then
163# @DESCRIPTION: 268 echo
164# Works like need_apache, but its used by modules that only support 269 eerror "You need to enable USE flag '${myflag}' to build a thread-safe version"
165# apache 2.2.x and do not work with other versions. 270 eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
166need_apache2_2() { 271 die "Need missing USE flag '${myflag}'"
167 debug-print-function $FUNCNAME $* 272 fi
168
169 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
170 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
171 _init_apache2
172} 273}
173 274
174# @FUNCTION: need_apache 275# @FUNCTION: has_apache_threads_in
276# @USAGE: <myforeign> [myflag]
175# @DESCRIPTION: 277# @DESCRIPTION:
176# An ebuild calls this to get the dependency information for apache. An 278# An ebuild calls this to make sure thread-safety is enabled in a foreign
177# ebuild should use this in order for future changes to the build infrastructure 279# package if apache has been built with a threaded MPM. If the myflag parameter
178# to happen seamlessly. All an ebuild needs to do is include the line 280# is not given it defaults to threads.
179# need_apache somewhere. 281has_apache_threads_in() {
180need_apache() {
181 debug-print-function $FUNCNAME $* 282 debug-print-function $FUNCNAME $*
182 need_apache2 283
284 if ! built_with_use www-servers/apache threads; then
285 return
286 fi
287
288 local myforeign="$1"
289 local myflag="${2:-threads}"
290
291 if ! built_with_use ${myforeign} ${myflag}; then
292 echo
293 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
294 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
295 eerror "with www-servers/apache"
296 die "Need missing USE flag '${myflag}' in ${myforeign}"
297 fi
183} 298}
299
300EXPORT_FUNCTIONS pkg_setup

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

  ViewVC Help
Powered by ViewVC 1.1.20