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

Diff of /eclass/apache-module.eclass

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

Revision 1.9 Revision 1.18
1# Copyright 2004 Gentoo Foundation 1# Copyright 2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License, v2 or later 2# Distributed under the terms of the GNU General Public License, v2 or later
3# Author Michael Tindal <urilith@gentoo.org> 3# Author Michael Tindal <urilith@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.9 2005/06/04 18:13:05 vericgar Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.18 2006/11/26 21:25:28 vericgar Exp $
5ECLASS=apache-module
6INHERITED="$INHERITED $ECLASS"
7 5
8inherit depend.apache 6inherit depend.apache
9 7
10# This eclass provides a common set of functions for Apache modules. 8# This eclass provides a common set of functions for Apache modules.
9
10# NOTE: If you use this, be sure you use the need_* call after you have
11# defined DEPEND and RDEPEND. Also note that you can not rely on the
12# automatic RDEPEND=DEPEND that portage does if you use this eclass.
13# See bug 107127 for more information.
11 14
12###### 15######
13## Common ebuild variables 16## Common ebuild variables
14###### 17######
15 18
47 50
48#### 51####
49## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE 52## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE
50## 53##
51## Name of define (eg FOO) to use in conditional loading of the installed 54## Name of define (eg FOO) to use in conditional loading of the installed
52## module/it's config file 55## module/it's config file, multiple defines should be space separated
53#### 56####
54APACHE1_MOD_DEFINE="" 57APACHE1_MOD_DEFINE=""
55APACHE2_MOD_DEFINE="" 58APACHE2_MOD_DEFINE=""
56 59
57#### 60####
71## apache_cd_dir 74## apache_cd_dir
72## 75##
73## Return the path to our temporary build dir 76## Return the path to our temporary build dir
74#### 77####
75apache_cd_dir() { 78apache_cd_dir() {
76 debug-print-function apache_cd_dir 79 debug-print-function $FUNCNAME $*
77 80
78 if [ "${APACHE_VERSION}" == "1" ]; then 81 if [ "${APACHE_VERSION}" == "1" ]; then
79 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}" 82 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}"
80 else 83 else
81 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}" 84 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}"
98## apache_mod_file 101## apache_mod_file
99## 102##
100## Return the path to the module file 103## Return the path to the module file
101#### 104####
102apache_mod_file() { 105apache_mod_file() {
103 debug-print-function apache_mod_file 106 debug-print-function $FUNCNAME $*
104 107
105 if [ "${APACHE_VERSION}" == "1" ]; then 108 if [ "${APACHE_VERSION}" == "1" ]; then
106 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}" 109 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}"
107 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so" 110 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so"
108 else 111 else
109 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}" 112 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}"
110 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" 113 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so"
111 fi 114 fi
112 115
113 debug-print apache_mod_file: MOD_FILE=${MOD_FILE} 116 debug-print apache_mod_file: MOD_FILE=${MOD_FILE}
114 echo ${MOD_FILE} 117 echo ${MOD_FILE}
115} 118}
121## an optional first argument `html'; if the first argument is equals 124## an optional first argument `html'; if the first argument is equals
122## `html', only html files are returned, otherwise normal (non-html) 125## `html', only html files are returned, otherwise normal (non-html)
123## docs are returned. 126## docs are returned.
124#### 127####
125apache_doc_magic() { 128apache_doc_magic() {
126 debug-print-function apache_doc_magic $* 129 debug-print-function $FUNCNAME $*
127 130
128 if [ -n "${DOCFILES}" ]; then 131 if [ -n "${DOCFILES}" ]; then
129 if [ "x$1" == "xhtml" ]; then 132 if [ "x$1" == "xhtml" ]; then
130 DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`" 133 DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`"
131 else 134 else
146## The default action is to call ${APXS11} with the value of 149## The default action is to call ${APXS11} with the value of
147## ${APXS1_ARGS}. If a module requires a different build setup 150## ${APXS1_ARGS}. If a module requires a different build setup
148## than this, use ${APXS1} in your own src_compile routine. 151## than this, use ${APXS1} in your own src_compile routine.
149#### 152####
150apache1_src_compile() { 153apache1_src_compile() {
151 debug-print-function apache1_src_compile 154 debug-print-function $FUNCNAME $*
152 155
153 CD_DIR=$(apache_cd_dir) 156 CD_DIR=$(apache_cd_dir)
154 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 157 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
155 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}" 158 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}"
156 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed" 159 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed"
162## This installs the files into apache's directories. The module is installed 165## This installs the files into apache's directories. The module is installed
163## from a directory chosen as above (APXS2_S or ${S}/src). In addition, 166## from a directory chosen as above (APXS2_S or ${S}/src). In addition,
164## this function can also set the executable permission on files listed in EXECFILES. 167## this function can also set the executable permission on files listed in EXECFILES.
165## The configuration file name is listed in APACHE1_MOD_CONF without the .conf extensions, 168## The configuration file name is listed in APACHE1_MOD_CONF without the .conf extensions,
166## so if you configuration is 55_mod_foo.conf, APACHE1_MOD_CONF would be 55_mod_foo. 169## so if you configuration is 55_mod_foo.conf, APACHE1_MOD_CONF would be 55_mod_foo.
167## DOCFILES contains the list of files you want filed as documentation. The name of the 170## DOCFILES contains the list of files you want filed as documentation. The name of the
168## module can also be specified using the APACHE1_MOD_FILE or defaults to 171## module can also be specified using the APACHE1_MOD_FILE or defaults to
169## .libs/${PN}.so. 172## .libs/${PN}.so.
170#### 173####
171apache1_src_install() { 174apache1_src_install() {
172 debug-print-function apache1_src_install 175 debug-print-function $FUNCNAME $*
173 176
174 CD_DIR=$(apache_cd_dir) 177 CD_DIR=$(apache_cd_dir)
175 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 178 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
176 179
177 MOD_FILE=$(apache_mod_file) 180 MOD_FILE=$(apache_mod_file)
182 185
183 if [ -n "${APACHE1_MOD_CONF}" ] ; then 186 if [ -n "${APACHE1_MOD_CONF}" ] ; then
184 insinto ${APACHE1_MODULES_CONFDIR} 187 insinto ${APACHE1_MODULES_CONFDIR}
185 doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE1_MOD_CONF}.conf' not found." 188 doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE1_MOD_CONF}.conf' not found."
186 fi 189 fi
187 190
188 cd ${S} 191 cd ${S}
189 192
190 if [ -n "${DOCFILES}" ] ; then 193 if [ -n "${DOCFILES}" ] ; then
191 OTHER_DOCS=$(apache_doc_magic) 194 OTHER_DOCS=$(apache_doc_magic)
192 HTML_DOCS=$(apache_doc_magic html) 195 HTML_DOCS=$(apache_doc_magic html)
200## apache1_pkg_postinst 203## apache1_pkg_postinst
201## 204##
202## Prints the standard config message, unless APACHE1_NO_CONFIG is set to yes. 205## Prints the standard config message, unless APACHE1_NO_CONFIG is set to yes.
203#### 206####
204apache1_pkg_postinst() { 207apache1_pkg_postinst() {
205 debug-print-function apache1_pkg_postinst 208 debug-print-function $FUNCNAME $*
206 209
207 if [ -n "${APACHE1_MOD_DEFINE}" ]; then 210 if [ -n "${APACHE1_MOD_DEFINE}" ]; then
211 local my_opts="-D ${APACHE1_MOD_DEFINE// / -D }"
212
208 einfo 213 einfo
209 einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache file and" 214 einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache file and"
210 einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." 215 einfo "add '${my_opts}' to APACHE_OPTS."
211 einfo 216 einfo
212 fi 217 fi
213 if [ -n "${APACHE1_MOD_CONF}" ] ; then 218 if [ -n "${APACHE1_MOD_CONF}" ] ; then
214 einfo 219 einfo
215 einfo "Configuration file installed as" 220 einfo "Configuration file installed as"
229## Checks to see if APACHE2_MT_UNSAFE is set to anything other than "no". If it is, then 234## Checks to see if APACHE2_MT_UNSAFE is set to anything other than "no". If it is, then
230## we check what the MPM style used by Apache is, if it isnt prefork, we let the user 235## we check what the MPM style used by Apache is, if it isnt prefork, we let the user
231## know they need prefork, and then exit the build. 236## know they need prefork, and then exit the build.
232#### 237####
233apache2_pkg_setup() { 238apache2_pkg_setup() {
234 debug-print-function apache2_pkg_setup 239 debug-print-function $FUNCNAME $*
235 240
236 if [ -n "${APACHE2_SAFE_MPMS}" ]; then 241 if [ -n "${APACHE2_SAFE_MPMS}" ]; then
237 242
238 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" 243 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)"
239 244
251 fi 256 fi
252 257
253 fi 258 fi
254 259
255} 260}
256 261
257#### 262####
258## apache2_src_compile 263## apache2_src_compile
259## 264##
260## The default action is to call ${APXS2} with the value of 265## The default action is to call ${APXS2} with the value of
261## ${APXS2_ARGS}. If a module requires a different build setup 266## ${APXS2_ARGS}. If a module requires a different build setup
262## than this, use ${APXS2} in your own src_compile routine. 267## than this, use ${APXS2} in your own src_compile routine.
263#### 268####
264apache2_src_compile() { 269apache2_src_compile() {
265 debug-print-function apache2_src_compile 270 debug-print-function $FUNCNAME $*
266 271
267 CD_DIR=$(apache_cd_dir) 272 CD_DIR=$(apache_cd_dir)
268 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 273 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
269 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" 274 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}"
270 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed" 275 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed"
279## The configuration file name is listed in CONFFILE without the .conf extensions, 284## The configuration file name is listed in CONFFILE without the .conf extensions,
280## so if you configuration is 55_mod_foo.conf, CONFFILE would be 55_mod_foo. 285## so if you configuration is 55_mod_foo.conf, CONFFILE would be 55_mod_foo.
281## DOCFILES contains the list of files you want filed as documentation. 286## DOCFILES contains the list of files you want filed as documentation.
282#### 287####
283apache2_src_install() { 288apache2_src_install() {
284 debug-print-function apache2_src_install 289 debug-print-function $FUNCNAME $*
285 290
286 CD_DIR=$(apache_cd_dir) 291 CD_DIR=$(apache_cd_dir)
287 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 292 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
288 293
289 MOD_FILE=$(apache_mod_file) 294 MOD_FILE=$(apache_mod_file)
296 insinto ${APACHE2_MODULES_CONFDIR} 301 insinto ${APACHE2_MODULES_CONFDIR}
297 doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE2_MOD_CONF}.conf' not found." 302 doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE2_MOD_CONF}.conf' not found."
298 fi 303 fi
299 304
300 if [ -n "${APACHE2_VHOSTFILE}" ]; then 305 if [ -n "${APACHE2_VHOSTFILE}" ]; then
301 insinto ${APACHE2_MODULES_VHOSTDIR} 306 insinto ${APACHE2_VHOSTDIR}
302 doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf 307 doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf
303 fi 308 fi
304 309
305 cd ${S} 310 cd ${S}
306 311
312 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} 317 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS}
313 fi 318 fi
314} 319}
315 320
316apache2_pkg_postinst() { 321apache2_pkg_postinst() {
317 debug-print-function apache2_pkg_postinst 322 debug-print-function $FUNCNAME $*
318 323
319 if [ -n "${APACHE2_MOD_DEFINE}" ]; then 324 if [ -n "${APACHE2_MOD_DEFINE}" ]; then
325 local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }"
326
320 einfo 327 einfo
321 einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and" 328 einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and"
322 einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." 329 einfo "add '${my_opts}' to APACHE2_OPTS."
323 einfo 330 einfo
324 fi 331 fi
325 if [ -n "${APACHE2_MOD_CONF}" ] ; then 332 if [ -n "${APACHE2_MOD_CONF}" ] ; then
326 einfo 333 einfo
327 einfo "Configuration file installed as" 334 einfo "Configuration file installed as"
337 if ! hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then 344 if ! hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then
338 INSTALLED_MPM_UNSAFE="${INSTALLED_MPM_UNSAFE} ${mpm}" 345 INSTALLED_MPM_UNSAFE="${INSTALLED_MPM_UNSAFE} ${mpm}"
339 else 346 else
340 INSTALLED_MPM_SAFE="${INSTALLED_MPM_SAFE} ${mpm}" 347 INSTALLED_MPM_SAFE="${INSTALLED_MPM_SAFE} ${mpm}"
341 fi 348 fi
342 349
343 if [ -n "${INSTALLED_MPM_UNSAFE}" ] ; then 350 if [ -n "${INSTALLED_MPM_UNSAFE}" ] ; then
344 ewarn "You have one or more MPMs installed that will not work with" 351 ewarn "You have one or more MPMs installed that will not work with"
345 ewarn "this module (${PN}). Please make sure that you only enable" 352 ewarn "this module (${PN}). Please make sure that you only enable"
346 ewarn "this module if you are using one of the following MPMs:" 353 ewarn "this module if you are using one of the following MPMs:"
347 ewarn " ${INSTALLED_MPM_SAFE}" 354 ewarn " ${INSTALLED_MPM_SAFE}"
348 fi 355 fi
349 356
350 fi 357 fi
351 358
352
353} 359}
354 360
355###### 361######
356## Apache dual (1.x or 2.x) ebuild functions 362## Apache dual (1.x or 2.x) ebuild functions
357## 363##
360## to call. If a function is provided by a given section (ie pkg_postinst in Apache 2.x) 366## to call. If a function is provided by a given section (ie pkg_postinst in Apache 2.x)
361## the exported routine simply does nothing. 367## the exported routine simply does nothing.
362###### 368######
363 369
364apache-module_pkg_setup() { 370apache-module_pkg_setup() {
365 debug-print-function apache-module_pkg_setup 371 debug-print-function $FUNCNAME $*
366 372
367 if [ ${APACHE_VERSION} -eq '2' ]; then 373 if [ ${APACHE_VERSION} -eq '2' ]; then
368 apache2_pkg_setup 374 apache2_pkg_setup
369 fi 375 fi
370} 376}
371 377
372apache-module_src_compile() { 378apache-module_src_compile() {
373 debug-print-function apache-module_src_compile 379 debug-print-function $FUNCNAME $*
374 380
375 if [ ${APACHE_VERSION} -eq '1' ]; then 381 if [ ${APACHE_VERSION} -eq '1' ]; then
376 apache1_src_compile 382 apache1_src_compile
377 else 383 else
378 apache2_src_compile 384 apache2_src_compile
379 fi 385 fi
380} 386}
381 387
382apache-module_src_install() { 388apache-module_src_install() {
383 debug-print-function apache-module_src_install 389 debug-print-function $FUNCNAME $*
384 390
385 if [ ${APACHE_VERSION} -eq '1' ]; then 391 if [ ${APACHE_VERSION} -eq '1' ]; then
386 apache1_src_install 392 apache1_src_install
387 else 393 else
388 apache2_src_install 394 apache2_src_install
389 fi 395 fi
390} 396}
391 397
392apache-module_pkg_postinst() { 398apache-module_pkg_postinst() {
393 debug-print-function apache-module_pkg_postinst 399 debug-print-function $FUNCNAME $*
394 400
395 if [ ${APACHE_VERSION} -eq '1' ]; then 401 if [ ${APACHE_VERSION} -eq '1' ]; then
396 apache1_pkg_postinst 402 apache1_pkg_postinst
397 else 403 else
398 apache2_pkg_postinst 404 apache2_pkg_postinst

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20