/[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.12 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.12 2005/07/11 15:08:06 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
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.
9 14
10###### 15######
11## Common ebuild variables 16## Common ebuild variables
12###### 17######
13 18
45 50
46#### 51####
47## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE 52## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE
48## 53##
49## 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
50## module/it's config file 55## module/it's config file, multiple defines should be space separated
51#### 56####
52APACHE1_MOD_DEFINE="" 57APACHE1_MOD_DEFINE=""
53APACHE2_MOD_DEFINE="" 58APACHE2_MOD_DEFINE=""
54 59
55#### 60####
69## apache_cd_dir 74## apache_cd_dir
70## 75##
71## Return the path to our temporary build dir 76## Return the path to our temporary build dir
72#### 77####
73apache_cd_dir() { 78apache_cd_dir() {
74 debug-print-function apache_cd_dir 79 debug-print-function $FUNCNAME $*
75 80
76 if [ "${APACHE_VERSION}" == "1" ]; then 81 if [ "${APACHE_VERSION}" == "1" ]; then
77 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}" 82 [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}"
78 else 83 else
79 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}" 84 [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}"
96## apache_mod_file 101## apache_mod_file
97## 102##
98## Return the path to the module file 103## Return the path to the module file
99#### 104####
100apache_mod_file() { 105apache_mod_file() {
101 debug-print-function apache_mod_file 106 debug-print-function $FUNCNAME $*
102 107
103 if [ "${APACHE_VERSION}" == "1" ]; then 108 if [ "${APACHE_VERSION}" == "1" ]; then
104 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}" 109 [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}"
105 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so" 110 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so"
106 else 111 else
107 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}" 112 [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}"
108 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" 113 [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so"
109 fi 114 fi
110 115
111 debug-print apache_mod_file: MOD_FILE=${MOD_FILE} 116 debug-print apache_mod_file: MOD_FILE=${MOD_FILE}
112 echo ${MOD_FILE} 117 echo ${MOD_FILE}
113} 118}
119## an optional first argument `html'; if the first argument is equals 124## an optional first argument `html'; if the first argument is equals
120## `html', only html files are returned, otherwise normal (non-html) 125## `html', only html files are returned, otherwise normal (non-html)
121## docs are returned. 126## docs are returned.
122#### 127####
123apache_doc_magic() { 128apache_doc_magic() {
124 debug-print-function apache_doc_magic $* 129 debug-print-function $FUNCNAME $*
125 130
126 if [ -n "${DOCFILES}" ]; then 131 if [ -n "${DOCFILES}" ]; then
127 if [ "x$1" == "xhtml" ]; then 132 if [ "x$1" == "xhtml" ]; then
128 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'`"
129 else 134 else
144## The default action is to call ${APXS11} with the value of 149## The default action is to call ${APXS11} with the value of
145## ${APXS1_ARGS}. If a module requires a different build setup 150## ${APXS1_ARGS}. If a module requires a different build setup
146## than this, use ${APXS1} in your own src_compile routine. 151## than this, use ${APXS1} in your own src_compile routine.
147#### 152####
148apache1_src_compile() { 153apache1_src_compile() {
149 debug-print-function apache1_src_compile 154 debug-print-function $FUNCNAME $*
150 155
151 CD_DIR=$(apache_cd_dir) 156 CD_DIR=$(apache_cd_dir)
152 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 157 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
153 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}" 158 APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}"
154 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed" 159 ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed"
165## 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
166## 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
167## .libs/${PN}.so. 172## .libs/${PN}.so.
168#### 173####
169apache1_src_install() { 174apache1_src_install() {
170 debug-print-function apache1_src_install 175 debug-print-function $FUNCNAME $*
171 176
172 CD_DIR=$(apache_cd_dir) 177 CD_DIR=$(apache_cd_dir)
173 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 178 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
174 179
175 MOD_FILE=$(apache_mod_file) 180 MOD_FILE=$(apache_mod_file)
198## apache1_pkg_postinst 203## apache1_pkg_postinst
199## 204##
200## 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.
201#### 206####
202apache1_pkg_postinst() { 207apache1_pkg_postinst() {
203 debug-print-function apache1_pkg_postinst 208 debug-print-function $FUNCNAME $*
204 209
205 if [ -n "${APACHE1_MOD_DEFINE}" ]; then 210 if [ -n "${APACHE1_MOD_DEFINE}" ]; then
211 local my_opts="-D ${APACHE1_MOD_DEFINE// / -D }"
212
206 einfo 213 einfo
207 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"
208 einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." 215 einfo "add '${my_opts}' to APACHE_OPTS."
209 einfo 216 einfo
210 fi 217 fi
211 if [ -n "${APACHE1_MOD_CONF}" ] ; then 218 if [ -n "${APACHE1_MOD_CONF}" ] ; then
212 einfo 219 einfo
213 einfo "Configuration file installed as" 220 einfo "Configuration file installed as"
227## 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
228## 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
229## know they need prefork, and then exit the build. 236## know they need prefork, and then exit the build.
230#### 237####
231apache2_pkg_setup() { 238apache2_pkg_setup() {
232 debug-print-function apache2_pkg_setup 239 debug-print-function $FUNCNAME $*
233 240
234 if [ -n "${APACHE2_SAFE_MPMS}" ]; then 241 if [ -n "${APACHE2_SAFE_MPMS}" ]; then
235 242
236 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" 243 INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)"
237 244
258## The default action is to call ${APXS2} with the value of 265## The default action is to call ${APXS2} with the value of
259## ${APXS2_ARGS}. If a module requires a different build setup 266## ${APXS2_ARGS}. If a module requires a different build setup
260## than this, use ${APXS2} in your own src_compile routine. 267## than this, use ${APXS2} in your own src_compile routine.
261#### 268####
262apache2_src_compile() { 269apache2_src_compile() {
263 debug-print-function apache2_src_compile 270 debug-print-function $FUNCNAME $*
264 271
265 CD_DIR=$(apache_cd_dir) 272 CD_DIR=$(apache_cd_dir)
266 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 273 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
267 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" 274 APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}"
268 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed" 275 ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed"
277## 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,
278## 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.
279## DOCFILES contains the list of files you want filed as documentation. 286## DOCFILES contains the list of files you want filed as documentation.
280#### 287####
281apache2_src_install() { 288apache2_src_install() {
282 debug-print-function apache2_src_install 289 debug-print-function $FUNCNAME $*
283 290
284 CD_DIR=$(apache_cd_dir) 291 CD_DIR=$(apache_cd_dir)
285 cd ${CD_DIR} || die "cd ${CD_DIR} failed" 292 cd ${CD_DIR} || die "cd ${CD_DIR} failed"
286 293
287 MOD_FILE=$(apache_mod_file) 294 MOD_FILE=$(apache_mod_file)
294 insinto ${APACHE2_MODULES_CONFDIR} 301 insinto ${APACHE2_MODULES_CONFDIR}
295 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."
296 fi 303 fi
297 304
298 if [ -n "${APACHE2_VHOSTFILE}" ]; then 305 if [ -n "${APACHE2_VHOSTFILE}" ]; then
299 insinto ${APACHE2_MODULES_VHOSTDIR} 306 insinto ${APACHE2_VHOSTDIR}
300 doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf 307 doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf
301 fi 308 fi
302 309
303 cd ${S} 310 cd ${S}
304 311
310 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} 317 [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS}
311 fi 318 fi
312} 319}
313 320
314apache2_pkg_postinst() { 321apache2_pkg_postinst() {
315 debug-print-function apache2_pkg_postinst 322 debug-print-function $FUNCNAME $*
316 323
317 if [ -n "${APACHE2_MOD_DEFINE}" ]; then 324 if [ -n "${APACHE2_MOD_DEFINE}" ]; then
325 local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }"
326
318 einfo 327 einfo
319 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"
320 einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." 329 einfo "add '${my_opts}' to APACHE2_OPTS."
321 einfo 330 einfo
322 fi 331 fi
323 if [ -n "${APACHE2_MOD_CONF}" ] ; then 332 if [ -n "${APACHE2_MOD_CONF}" ] ; then
324 einfo 333 einfo
325 einfo "Configuration file installed as" 334 einfo "Configuration file installed as"
357## 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)
358## the exported routine simply does nothing. 367## the exported routine simply does nothing.
359###### 368######
360 369
361apache-module_pkg_setup() { 370apache-module_pkg_setup() {
362 debug-print-function apache-module_pkg_setup 371 debug-print-function $FUNCNAME $*
363 372
364 if [ ${APACHE_VERSION} -eq '2' ]; then 373 if [ ${APACHE_VERSION} -eq '2' ]; then
365 apache2_pkg_setup 374 apache2_pkg_setup
366 fi 375 fi
367} 376}
368 377
369apache-module_src_compile() { 378apache-module_src_compile() {
370 debug-print-function apache-module_src_compile 379 debug-print-function $FUNCNAME $*
371 380
372 if [ ${APACHE_VERSION} -eq '1' ]; then 381 if [ ${APACHE_VERSION} -eq '1' ]; then
373 apache1_src_compile 382 apache1_src_compile
374 else 383 else
375 apache2_src_compile 384 apache2_src_compile
376 fi 385 fi
377} 386}
378 387
379apache-module_src_install() { 388apache-module_src_install() {
380 debug-print-function apache-module_src_install 389 debug-print-function $FUNCNAME $*
381 390
382 if [ ${APACHE_VERSION} -eq '1' ]; then 391 if [ ${APACHE_VERSION} -eq '1' ]; then
383 apache1_src_install 392 apache1_src_install
384 else 393 else
385 apache2_src_install 394 apache2_src_install
386 fi 395 fi
387} 396}
388 397
389apache-module_pkg_postinst() { 398apache-module_pkg_postinst() {
390 debug-print-function apache-module_pkg_postinst 399 debug-print-function $FUNCNAME $*
391 400
392 if [ ${APACHE_VERSION} -eq '1' ]; then 401 if [ ${APACHE_VERSION} -eq '1' ]; then
393 apache1_pkg_postinst 402 apache1_pkg_postinst
394 else 403 else
395 apache2_pkg_postinst 404 apache2_pkg_postinst

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

  ViewVC Help
Powered by ViewVC 1.1.20