1 |
chtekk |
1.30 |
# Copyright 1999-2007 Gentoo Foundation |
2 |
stuart |
1.20 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
hollow |
1.42 |
# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.41 2008/02/06 13:16:17 hollow Exp $ |
4 |
stuart |
1.2 |
|
5 |
hollow |
1.35 |
# @ECLASS: depend.apache.eclass |
6 |
|
|
# @MAINTAINER: apache-devs@gentoo.org |
7 |
|
|
# @BLURB: Functions to allow ebuilds to depend on apache |
8 |
|
|
# @DESCRIPTION: |
9 |
hollow |
1.40 |
# This eclass handles depending on apache in a sane way and provides information |
10 |
|
|
# about where certain binaries and configuration files are located. |
11 |
hollow |
1.35 |
# |
12 |
hollow |
1.40 |
# To make use of this eclass simply call one of the need/want_apache functions |
13 |
|
|
# described below. Make sure you use the need/want_apache call after you have |
14 |
|
|
# defined DEPEND and RDEPEND. Also note that you can not rely on the automatic |
15 |
hollow |
1.35 |
# RDEPEND=DEPEND that portage does if you use this eclass. |
16 |
|
|
# |
17 |
hollow |
1.40 |
# See Bug 107127 for more information. |
18 |
|
|
# |
19 |
|
|
# @EXAMPLE: |
20 |
|
|
# |
21 |
|
|
# Here is an example of an ebuild depending on apache: |
22 |
|
|
# |
23 |
|
|
# @CODE |
24 |
|
|
# DEPEND="virtual/Perl-CGI" |
25 |
|
|
# RDEPEND="${DEPEND}" |
26 |
|
|
# need_apache2 |
27 |
|
|
# @CODE |
28 |
|
|
# |
29 |
|
|
# Another example which demonstrates non-standard IUSE options for optional |
30 |
|
|
# apache support: |
31 |
|
|
# |
32 |
|
|
# @CODE |
33 |
|
|
# DEPEND="server? ( virtual/Perl-CGI )" |
34 |
|
|
# RDEPEND="${DEPEND}" |
35 |
|
|
# want_apache2 server |
36 |
|
|
# @CODE |
37 |
vericgar |
1.25 |
|
38 |
hollow |
1.35 |
inherit multilib |
39 |
vericgar |
1.25 |
|
40 |
hollow |
1.35 |
# ============================================================================== |
41 |
|
|
# INTERNAL VARIABLES |
42 |
|
|
# ============================================================================== |
43 |
|
|
|
44 |
|
|
# @ECLASS-VARIABLE: APACHE_VERSION |
45 |
|
|
# @DESCRIPTION: |
46 |
hollow |
1.40 |
# Stores the version of apache we are going to be ebuilding. |
47 |
|
|
# This variable is set by the want/need_apache functions. |
48 |
urilith |
1.6 |
|
49 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APXS |
50 |
hollow |
1.35 |
# @DESCRIPTION: |
51 |
hollow |
1.41 |
# Path to the apxs tool. |
52 |
hollow |
1.40 |
# This variable is set by the want/need_apache functions. |
53 |
|
|
|
54 |
|
|
# @ECLASS-VARIABLE: APACHE_BIN |
55 |
|
|
# @DESCRIPTION: |
56 |
|
|
# Path to the apache binary. |
57 |
|
|
# This variable is set by the want/need_apache functions. |
58 |
urilith |
1.6 |
|
59 |
hollow |
1.40 |
# @ECLASS-VARIABLE: APACHE_CTL |
60 |
hollow |
1.35 |
# @DESCRIPTION: |
61 |
hollow |
1.40 |
# Path to the apachectl tool. |
62 |
|
|
# This variable is set by the want/need_apache functions. |
63 |
urilith |
1.6 |
|
64 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APACHE_BASEDIR |
65 |
hollow |
1.35 |
# @DESCRIPTION: |
66 |
hollow |
1.40 |
# Path to the server root directory. |
67 |
|
|
# This variable is set by the want/need_apache functions. |
68 |
urilith |
1.6 |
|
69 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APACHE_CONFDIR |
70 |
hollow |
1.35 |
# @DESCRIPTION: |
71 |
hollow |
1.40 |
# Path to the configuration file directory. |
72 |
|
|
# This variable is set by the want/need_apache functions. |
73 |
urilith |
1.6 |
|
74 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR |
75 |
hollow |
1.35 |
# @DESCRIPTION: |
76 |
hollow |
1.40 |
# Path where module configuration files are kept. |
77 |
|
|
# This variable is set by the want/need_apache functions. |
78 |
urilith |
1.6 |
|
79 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR |
80 |
hollow |
1.35 |
# @DESCRIPTION: |
81 |
hollow |
1.40 |
# Path where virtual host configuration files are kept. |
82 |
|
|
# This variable is set by the want/need_apache functions. |
83 |
urilith |
1.6 |
|
84 |
hollow |
1.36 |
# @ECLASS-VARIABLE: APACHE_MODULESDIR |
85 |
hollow |
1.35 |
# @DESCRIPTION: |
86 |
hollow |
1.40 |
# Path where we install modules. |
87 |
|
|
# This variable is set by the want/need_apache functions. |
88 |
urilith |
1.6 |
|
89 |
hollow |
1.37 |
# @ECLASS-VARIABLE: APACHE_DEPEND |
90 |
|
|
# @DESCRIPTION: |
91 |
|
|
# Dependencies for Apache |
92 |
|
|
APACHE_DEPEND="www-servers/apache" |
93 |
|
|
|
94 |
hollow |
1.35 |
# @ECLASS-VARIABLE: APACHE2_DEPEND |
95 |
|
|
# @DESCRIPTION: |
96 |
|
|
# Dependencies for Apache 2.x |
97 |
phreak |
1.33 |
APACHE2_DEPEND="=www-servers/apache-2*" |
98 |
hollow |
1.35 |
|
99 |
|
|
# @ECLASS-VARIABLE: APACHE2_2_DEPEND |
100 |
|
|
# @DESCRIPTION: |
101 |
|
|
# Dependencies for Apache 2.2.x |
102 |
phreak |
1.33 |
APACHE2_2_DEPEND="=www-servers/apache-2.2*" |
103 |
vericgar |
1.7 |
|
104 |
hollow |
1.35 |
# ============================================================================== |
105 |
|
|
# INTERNAL FUNCTIONS |
106 |
|
|
# ============================================================================== |
107 |
|
|
|
108 |
hollow |
1.37 |
_init_apache2() { |
109 |
vericgar |
1.28 |
debug-print-function $FUNCNAME $* |
110 |
stuart |
1.20 |
|
111 |
vericgar |
1.28 |
# WARNING: Do not use these variables with anything that is put |
112 |
|
|
# into the dependency cache (DEPEND/RDEPEND/etc) |
113 |
chtekk |
1.30 |
APACHE_VERSION="2" |
114 |
hollow |
1.36 |
APXS="/usr/sbin/apxs2" |
115 |
hollow |
1.38 |
APACHE_BIN="/usr/sbin/apache2" |
116 |
|
|
APACHE_CTL="/usr/sbin/apache2ctl" |
117 |
hollow |
1.42 |
APACHE_INCLUDEDIR="/usr/include/apache2" |
118 |
hollow |
1.36 |
APACHE_BASEDIR="/usr/$(get_libdir)/apache2" |
119 |
|
|
APACHE_CONFDIR="/etc/apache2" |
120 |
|
|
APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d" |
121 |
|
|
APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d" |
122 |
|
|
APACHE_MODULESDIR="${APACHE_BASEDIR}/modules" |
123 |
stuart |
1.20 |
} |
124 |
|
|
|
125 |
hollow |
1.37 |
_init_no_apache() { |
126 |
vericgar |
1.28 |
debug-print-function $FUNCNAME $* |
127 |
chtekk |
1.30 |
APACHE_VERSION="0" |
128 |
stuart |
1.20 |
} |
129 |
vericgar |
1.9 |
|
130 |
hollow |
1.35 |
# ============================================================================== |
131 |
|
|
# PUBLIC FUNCTIONS |
132 |
|
|
# ============================================================================== |
133 |
|
|
|
134 |
|
|
# @FUNCTION: want_apache |
135 |
hollow |
1.40 |
# @USAGE: [myiuse] |
136 |
|
|
# @DESCRIPTION: |
137 |
|
|
# 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. |
139 |
|
|
want_apache() { |
140 |
|
|
debug-print-function $FUNCNAME $* |
141 |
|
|
want_apache2 "$@" |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
# @FUNCTION: want_apache2 |
145 |
|
|
# @USAGE: [myiuse] |
146 |
hollow |
1.35 |
# @DESCRIPTION: |
147 |
|
|
# An ebuild calls this to get the dependency information for optional apache-2.x |
148 |
hollow |
1.40 |
# support. If the myiuse parameter is not given it defaults to apache2. |
149 |
hollow |
1.37 |
want_apache2() { |
150 |
vericgar |
1.28 |
debug-print-function $FUNCNAME $* |
151 |
stuart |
1.1 |
|
152 |
hollow |
1.39 |
local myiuse=${1:-apache2} |
153 |
|
|
IUSE="${IUSE} ${myiuse}" |
154 |
|
|
DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
155 |
|
|
RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" |
156 |
hollow |
1.35 |
|
157 |
hollow |
1.39 |
if use ${myiuse} ; then |
158 |
hollow |
1.37 |
_init_apache2 |
159 |
hollow |
1.35 |
else |
160 |
hollow |
1.37 |
_init_no_apache |
161 |
hollow |
1.35 |
fi |
162 |
stuart |
1.1 |
} |
163 |
|
|
|
164 |
hollow |
1.40 |
# @FUNCTION: want_apache2_2 |
165 |
|
|
# @USAGE: [myiuse] |
166 |
hollow |
1.35 |
# @DESCRIPTION: |
167 |
hollow |
1.37 |
# An ebuild calls this to get the dependency information for optional |
168 |
hollow |
1.40 |
# apache-2.2.x support. If the myiuse parameter is not given it defaults to |
169 |
|
|
# apache2. |
170 |
hollow |
1.37 |
want_apache2_2() { |
171 |
vericgar |
1.28 |
debug-print-function $FUNCNAME $* |
172 |
stuart |
1.1 |
|
173 |
hollow |
1.39 |
local myiuse=${1:-apache2} |
174 |
|
|
IUSE="${IUSE} ${myiuse}" |
175 |
|
|
DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
176 |
|
|
RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" |
177 |
hollow |
1.37 |
|
178 |
hollow |
1.39 |
if use ${myiuse} ; then |
179 |
hollow |
1.37 |
_init_apache2 |
180 |
|
|
else |
181 |
|
|
_init_no_apache |
182 |
|
|
fi |
183 |
|
|
} |
184 |
|
|
|
185 |
hollow |
1.40 |
# @FUNCTION: need_apache |
186 |
hollow |
1.37 |
# @DESCRIPTION: |
187 |
hollow |
1.40 |
# An ebuild calls this to get the dependency information for apache. |
188 |
|
|
need_apache() { |
189 |
hollow |
1.39 |
debug-print-function $FUNCNAME $* |
190 |
hollow |
1.40 |
need_apache2 |
191 |
stuart |
1.1 |
} |
192 |
|
|
|
193 |
hollow |
1.37 |
# @FUNCTION: need_apache2 |
194 |
hollow |
1.35 |
# @DESCRIPTION: |
195 |
hollow |
1.40 |
# An ebuild calls this to get the dependency information for apache-2.x. |
196 |
hollow |
1.37 |
need_apache2() { |
197 |
vericgar |
1.28 |
debug-print-function $FUNCNAME $* |
198 |
|
|
|
199 |
hollow |
1.37 |
DEPEND="${DEPEND} ${APACHE2_DEPEND}" |
200 |
|
|
RDEPEND="${RDEPEND} ${APACHE2_DEPEND}" |
201 |
|
|
_init_apache2 |
202 |
vericgar |
1.28 |
} |
203 |
|
|
|
204 |
hollow |
1.35 |
# @FUNCTION: need_apache2_2 |
205 |
|
|
# @DESCRIPTION: |
206 |
hollow |
1.40 |
# An ebuild calls this to get the dependency information for apache-2.2.x. |
207 |
vericgar |
1.28 |
need_apache2_2() { |
208 |
|
|
debug-print-function $FUNCNAME $* |
209 |
|
|
|
210 |
|
|
DEPEND="${DEPEND} ${APACHE2_2_DEPEND}" |
211 |
|
|
RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}" |
212 |
hollow |
1.37 |
_init_apache2 |
213 |
vericgar |
1.28 |
} |
214 |
hollow |
1.41 |
|
215 |
|
|
# @FUNCTION: check_apache_threads |
216 |
|
|
# @USAGE: [myflag] |
217 |
|
|
# @DESCRIPTION: |
218 |
|
|
# 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 |
220 |
|
|
# threads. |
221 |
|
|
check_apache_threads() { |
222 |
|
|
debug-print-function $FUNCNAME $* |
223 |
|
|
|
224 |
|
|
if ! built_with_use www-servers/apache threads ; then |
225 |
|
|
return |
226 |
|
|
fi |
227 |
|
|
|
228 |
|
|
local myflag="${1:-threads}" |
229 |
|
|
|
230 |
hollow |
1.42 |
if ! use ${myflag} ; then |
231 |
hollow |
1.41 |
echo |
232 |
|
|
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" |
234 |
|
|
die "Need missing USE flag '${myflag}'" |
235 |
|
|
fi |
236 |
|
|
} |
237 |
hollow |
1.42 |
|
238 |
|
|
# @FUNCTION: check_apache_threads_in |
239 |
|
|
# @USAGE: <myforeign> [myflag] |
240 |
|
|
# @DESCRIPTION: |
241 |
|
|
# 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 |
243 |
|
|
# is not given it defaults to threads. |
244 |
|
|
check_apache_threads_in() { |
245 |
|
|
debug-print-function $FUNCNAME $* |
246 |
|
|
|
247 |
|
|
if ! built_with_use www-servers/apache threads ; then |
248 |
|
|
return |
249 |
|
|
fi |
250 |
|
|
|
251 |
|
|
local myforeign="$1" |
252 |
|
|
local myflag="${2:-threads}" |
253 |
|
|
|
254 |
|
|
if ! built_with_use ${myforeign} ${myflag} ; then |
255 |
|
|
echo |
256 |
|
|
eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" |
257 |
|
|
eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" |
258 |
|
|
eerror "with www-servers/apache" |
259 |
|
|
die "Need missing USE flag '${myflag}' in ${myforeign}" |
260 |
|
|
fi |
261 |
|
|
} |