/[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.15 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.15 2006/06/10 16:19:54 swegener Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.18 2006/11/26 21:25:28 vericgar Exp $
5 5
6inherit depend.apache 6inherit depend.apache
7 7
8# This eclass provides a common set of functions for Apache modules. 8# This eclass provides a common set of functions for Apache modules.
9 9
50 50
51#### 51####
52## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE 52## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE
53## 53##
54## 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
55## module/it's config file 55## module/it's config file, multiple defines should be space separated
56#### 56####
57APACHE1_MOD_DEFINE="" 57APACHE1_MOD_DEFINE=""
58APACHE2_MOD_DEFINE="" 58APACHE2_MOD_DEFINE=""
59 59
60#### 60####
74## apache_cd_dir 74## apache_cd_dir
75## 75##
76## Return the path to our temporary build dir 76## Return the path to our temporary build dir
77#### 77####
78apache_cd_dir() { 78apache_cd_dir() {
79 debug-print-function apache_cd_dir 79 debug-print-function $FUNCNAME $*
80 80
81 if [ "${APACHE_VERSION}" == "1" ]; then 81 if [ "${APACHE_VERSION}" == "1" ]; then
82 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}" 82 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}"
83 else 83 else
84 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}" 84 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}"
101## apache_mod_file 101## apache_mod_file
102## 102##
103## Return the path to the module file 103## Return the path to the module file
104#### 104####
105apache_mod_file() { 105apache_mod_file() {
106 debug-print-function apache_mod_file 106 debug-print-function $FUNCNAME $*
107 107
108 if [ "${APACHE_VERSION}" == "1" ]; then 108 if [ "${APACHE_VERSION}" == "1" ]; then
109 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}" 109 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}"
110 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so" 110 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so"
111 else 111 else
112 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}" 112 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}"
113 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" 113 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so"
114 fi 114 fi
115 115
116 debug-print apache_mod_file: MOD_FILE=${MOD_FILE} 116 debug-print apache_mod_file: MOD_FILE=${MOD_FILE}
117 echo ${MOD_FILE} 117 echo ${MOD_FILE}
118} 118}
124## an optional first argument `html'; if the first argument is equals 124## an optional first argument `html'; if the first argument is equals
125## `html', only html files are returned, otherwise normal (non-html) 125## `html', only html files are returned, otherwise normal (non-html)
126## docs are returned. 126## docs are returned.
127#### 127####
128apache_doc_magic() { 128apache_doc_magic() {
129 debug-print-function apache_doc_magic $* 129 debug-print-function $FUNCNAME $*
130 130
131 if [ -n "${DOCFILES}" ]; then 131 if [ -n "${DOCFILES}" ]; then
132 if [ "x$1" == "xhtml" ]; then 132 if [ "x$1" == "xhtml" ]; then
133 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'`"
134 else 134 else
149## The default action is to call ${APXS11} with the value of 149## The default action is to call ${APXS11} with the value of
150## ${APXS1_ARGS}. If a module requires a different build setup 150## ${APXS1_ARGS}. If a module requires a different build setup
151## than this, use ${APXS1} in your own src_compile routine. 151## than this, use ${APXS1} in your own src_compile routine.
152#### 152####
153apache1_src_compile() { 153apache1_src_compile() {
154 debug-print-function apache1_src_compile 154 debug-print-function $FUNCNAME $*
155 155
156 CD_DIR=$(apache_cd_dir) 156 CD_DIR=$(apache_cd_dir)
157 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 157 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
158 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}" 158 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}"
159 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed" 159 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed"
170## 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
171## 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
172## .libs/${PN}.so. 172## .libs/${PN}.so.
173#### 173####
174apache1_src_install() { 174apache1_src_install() {
175 debug-print-function apache1_src_install 175 debug-print-function $FUNCNAME $*
176 176
177 CD_DIR=$(apache_cd_dir) 177 CD_DIR=$(apache_cd_dir)
178 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 178 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
179 179
180 MOD_FILE=$(apache_mod_file) 180 MOD_FILE=$(apache_mod_file)
203## apache1_pkg_postinst 203## apache1_pkg_postinst
204## 204##
205## 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.
206#### 206####
207apache1_pkg_postinst() { 207apache1_pkg_postinst() {
208 debug-print-function apache1_pkg_postinst 208 debug-print-function $FUNCNAME $*
209 209
210 if [ -n "${APACHE1_MOD_DEFINE}" ]; then 210 if [ -n "${APACHE1_MOD_DEFINE}" ]; then
211 local my_opts="-D ${APACHE1_MOD_DEFINE// / -D }"
212
211 einfo 213 einfo
212 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"
213 einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." 215 einfo "add '${my_opts}' to APACHE_OPTS."
214 einfo 216 einfo
215 fi 217 fi
216 if [ -n "${APACHE1_MOD_CONF}" ] ; then 218 if [ -n "${APACHE1_MOD_CONF}" ] ; then
217 einfo 219 einfo
218 einfo "Configuration file installed as" 220 einfo "Configuration file installed as"
232## 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
233## 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
234## know they need prefork, and then exit the build. 236## know they need prefork, and then exit the build.
235#### 237####
236apache2_pkg_setup() { 238apache2_pkg_setup() {
237 debug-print-function apache2_pkg_setup 239 debug-print-function $FUNCNAME $*
238 240
239 if [ -n "${APACHE2_SAFE_MPMS}" ]; then 241 if [ -n "${APACHE2_SAFE_MPMS}" ]; then
240 242
241 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" 243 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)"
242 244
263## The default action is to call ${APXS2} with the value of 265## The default action is to call ${APXS2} with the value of
264## ${APXS2_ARGS}. If a module requires a different build setup 266## ${APXS2_ARGS}. If a module requires a different build setup
265## than this, use ${APXS2} in your own src_compile routine. 267## than this, use ${APXS2} in your own src_compile routine.
266#### 268####
267apache2_src_compile() { 269apache2_src_compile() {
268 debug-print-function apache2_src_compile 270 debug-print-function $FUNCNAME $*
269 271
270 CD_DIR=$(apache_cd_dir) 272 CD_DIR=$(apache_cd_dir)
271 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 273 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
272 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" 274 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}"
273 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed" 275 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed"
282## 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,
283## 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.
284## DOCFILES contains the list of files you want filed as documentation. 286## DOCFILES contains the list of files you want filed as documentation.
285#### 287####
286apache2_src_install() { 288apache2_src_install() {
287 debug-print-function apache2_src_install 289 debug-print-function $FUNCNAME $*
288 290
289 CD_DIR=$(apache_cd_dir) 291 CD_DIR=$(apache_cd_dir)
290 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 292 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
291 293
292 MOD_FILE=$(apache_mod_file) 294 MOD_FILE=$(apache_mod_file)
315 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} 317 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS}
316 fi 318 fi
317} 319}
318 320
319apache2_pkg_postinst() { 321apache2_pkg_postinst() {
320 debug-print-function apache2_pkg_postinst 322 debug-print-function $FUNCNAME $*
321 323
322 if [ -n "${APACHE2_MOD_DEFINE}" ]; then 324 if [ -n "${APACHE2_MOD_DEFINE}" ]; then
325 local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }"
326
323 einfo 327 einfo
324 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"
325 einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." 329 einfo "add '${my_opts}' to APACHE2_OPTS."
326 einfo 330 einfo
327 fi 331 fi
328 if [ -n "${APACHE2_MOD_CONF}" ] ; then 332 if [ -n "${APACHE2_MOD_CONF}" ] ; then
329 einfo 333 einfo
330 einfo "Configuration file installed as" 334 einfo "Configuration file installed as"
362## 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)
363## the exported routine simply does nothing. 367## the exported routine simply does nothing.
364###### 368######
365 369
366apache-module_pkg_setup() { 370apache-module_pkg_setup() {
367 debug-print-function apache-module_pkg_setup 371 debug-print-function $FUNCNAME $*
368 372
369 if [ ${APACHE_VERSION} -eq '2' ]; then 373 if [ ${APACHE_VERSION} -eq '2' ]; then
370 apache2_pkg_setup 374 apache2_pkg_setup
371 fi 375 fi
372} 376}
373 377
374apache-module_src_compile() { 378apache-module_src_compile() {
375 debug-print-function apache-module_src_compile 379 debug-print-function $FUNCNAME $*
376 380
377 if [ ${APACHE_VERSION} -eq '1' ]; then 381 if [ ${APACHE_VERSION} -eq '1' ]; then
378 apache1_src_compile 382 apache1_src_compile
379 else 383 else
380 apache2_src_compile 384 apache2_src_compile
381 fi 385 fi
382} 386}
383 387
384apache-module_src_install() { 388apache-module_src_install() {
385 debug-print-function apache-module_src_install 389 debug-print-function $FUNCNAME $*
386 390
387 if [ ${APACHE_VERSION} -eq '1' ]; then 391 if [ ${APACHE_VERSION} -eq '1' ]; then
388 apache1_src_install 392 apache1_src_install
389 else 393 else
390 apache2_src_install 394 apache2_src_install
391 fi 395 fi
392} 396}
393 397
394apache-module_pkg_postinst() { 398apache-module_pkg_postinst() {
395 debug-print-function apache-module_pkg_postinst 399 debug-print-function $FUNCNAME $*
396 400
397 if [ ${APACHE_VERSION} -eq '1' ]; then 401 if [ ${APACHE_VERSION} -eq '1' ]; then
398 apache1_pkg_postinst 402 apache1_pkg_postinst
399 else 403 else
400 apache2_pkg_postinst 404 apache2_pkg_postinst

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

  ViewVC Help
Powered by ViewVC 1.1.20