/[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.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.39 2008/02/03 14:12:44 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 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"
66 103
67# @ECLASS-VARIABLE: APACHE2_2_DEPEND 104# @ECLASS-VARIABLE: APACHE2_2_DEPEND
68# @DESCRIPTION: 105# @DESCRIPTION:
69# Dependencies for Apache 2.2.x 106# Dependencies for Apache 2.2.x
70APACHE2_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
71 114
72# ============================================================================== 115# ==============================================================================
73# INTERNAL FUNCTIONS 116# INTERNAL FUNCTIONS
74# ============================================================================== 117# ==============================================================================
75 118
80 # into the dependency cache (DEPEND/RDEPEND/etc) 123 # into the dependency cache (DEPEND/RDEPEND/etc)
81 APACHE_VERSION="2" 124 APACHE_VERSION="2"
82 APXS="/usr/sbin/apxs2" 125 APXS="/usr/sbin/apxs2"
83 APACHE_BIN="/usr/sbin/apache2" 126 APACHE_BIN="/usr/sbin/apache2"
84 APACHE_CTL="/usr/sbin/apache2ctl" 127 APACHE_CTL="/usr/sbin/apache2ctl"
85 # legacy alias 128 APACHE_INCLUDEDIR="/usr/include/apache2"
86 APACHECTL="${APACHE_CTL}"
87 APACHE_BASEDIR="/usr/$(get_libdir)/apache2" 129 APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
88 APACHE_CONFDIR="/etc/apache2" 130 APACHE_CONFDIR="/etc/apache2"
89 APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d" 131 APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
90 APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d" 132 APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
91 APACHE_MODULESDIR="${APACHE_BASEDIR}/modules" 133 APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
98 140
99# ============================================================================== 141# ==============================================================================
100# PUBLIC FUNCTIONS 142# PUBLIC FUNCTIONS
101# ============================================================================== 143# ==============================================================================
102 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
103# @FUNCTION: want_apache 168# @FUNCTION: want_apache
169# @USAGE: [myiuse]
170# @DESCRIPTION:
171# An ebuild calls this to get the dependency information for optional apache
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.
175want_apache() {
176 debug-print-function $FUNCNAME $*
177 want_apache2 "$@"
178}
179
180# @FUNCTION: want_apache2
181# @USAGE: [myiuse]
104# @DESCRIPTION: 182# @DESCRIPTION:
105# 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
106# support. 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.
107want_apache2() { 187want_apache2() {
108 debug-print-function $FUNCNAME $* 188 debug-print-function $FUNCNAME $*
109 189
110 local myiuse=${1:-apache2} 190 local myiuse=${1:-apache2}
111 IUSE="${IUSE} ${myiuse}" 191 IUSE="${IUSE} ${myiuse}"
112 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 192 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
113 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" 193 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
114
115 if use ${myiuse} ; then
116 _init_apache2
117 else
118 _init_no_apache
119 fi
120} 194}
121 195
122# @FUNCTION: want_apache 196# @FUNCTION: want_apache2_2
197# @USAGE: [myiuse]
123# @DESCRIPTION: 198# @DESCRIPTION:
124# An ebuild calls this to get the dependency information for optional 199# An ebuild calls this to get the dependency information for optional
125# apache-2.2.x support. 200# apache-2.2.x support. If the myiuse parameter is not given it defaults to
201# apache2.
202# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
203# with the same myiuse parameter.
126want_apache2_2() { 204want_apache2_2() {
127 debug-print-function $FUNCNAME $* 205 debug-print-function $FUNCNAME $*
128 206
129 local myiuse=${1:-apache2} 207 local myiuse=${1:-apache2}
130 IUSE="${IUSE} ${myiuse}" 208 IUSE="${IUSE} ${myiuse}"
131 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 209 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
132 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" 210 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
211}
133 212
134 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
135 _init_apache2 263 _init_apache2
136 else 264 else
137 _init_no_apache 265 _init_no_apache
138 fi 266 fi
139} 267}
140 268
141# @FUNCTION: want_apache 269# @FUNCTION: has_apache_threads
270# @USAGE: [myflag]
142# @DESCRIPTION: 271# @DESCRIPTION:
143# An ebuild calls this to get the dependency information for optional apache 272# An ebuild calls this to make sure thread-safety is enabled if apache has been
144# support. 273# built with a threaded MPM. If the myflag parameter is not given it defaults to
145want_apache() { 274# threads.
275has_apache_threads() {
146 debug-print-function $FUNCNAME $* 276 debug-print-function $FUNCNAME $*
147 want_apache2 "$@"
148}
149 277
150# @FUNCTION: need_apache2 278 if ! built_with_use www-servers/apache threads; then
151# @DESCRIPTION: 279 return
152# Works like need_apache, but its used by modules that only support 280 fi
153# apache 2.x and do not work with other versions.
154need_apache2() {
155 debug-print-function $FUNCNAME $*
156 281
157 DEPEND="${DEPEND} ${APACHE2_DEPEND}" 282 local myflag="${1:-threads}"
158 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
159 _init_apache2
160}
161 283
162# @FUNCTION: need_apache2_2 284 if ! use ${myflag}; then
163# @DESCRIPTION: 285 echo
164# Works like need_apache, but its used by modules that only support 286 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. 287 eerror "of ${CATEGORY}/${PN} for use with www-servers/apache"
166need_apache2_2() { 288 die "Need missing USE flag '${myflag}'"
167 debug-print-function $FUNCNAME $* 289 fi
168
169 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
170 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
171 _init_apache2
172} 290}
173 291
174# @FUNCTION: need_apache 292# @FUNCTION: has_apache_threads_in
293# @USAGE: <myforeign> [myflag]
175# @DESCRIPTION: 294# @DESCRIPTION:
176# An ebuild calls this to get the dependency information for apache. An 295# 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 296# 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 297# is not given it defaults to threads.
179# need_apache somewhere. 298has_apache_threads_in() {
180need_apache() {
181 debug-print-function $FUNCNAME $* 299 debug-print-function $FUNCNAME $*
182 need_apache2 300
301 if ! built_with_use www-servers/apache threads; then
302 return
303 fi
304
305 local myforeign="$1"
306 local myflag="${2:-threads}"
307
308 if ! built_with_use ${myforeign} ${myflag}; then
309 echo
310 eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
311 eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
312 eerror "with www-servers/apache"
313 die "Need missing USE flag '${myflag}' in ${myforeign}"
314 fi
183} 315}
316
317EXPORT_FUNCTIONS pkg_setup

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

  ViewVC Help
Powered by ViewVC 1.1.20