| 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.2 2005/01/09 10:10:24 vericgar Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.12 2005/07/11 15:08:06 swegener Exp $ |
| 5 | ECLASS=apache-module |
|
|
| 6 | INHERITED="$INHERITED $ECLASS" |
|
|
| 7 | |
5 | |
| 8 | inherit depend.apache |
6 | inherit 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. |
| 11 | |
9 | |
| … | |
… | |
| 162 | ## This installs the files into apache's directories. The module is installed |
160 | ## 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, |
161 | ## 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. |
162 | ## 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, |
163 | ## 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. |
164 | ## 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 |
165 | ## 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 |
166 | ## module can also be specified using the APACHE1_MOD_FILE or defaults to |
| 169 | ## .libs/${PN}.so. |
167 | ## .libs/${PN}.so. |
| 170 | #### |
168 | #### |
| 171 | apache1_src_install() { |
169 | apache1_src_install() { |
| 172 | debug-print-function apache1_src_install |
170 | debug-print-function apache1_src_install |
| 173 | |
171 | |
| 174 | CD_DIR=$(apache_cd_dir) |
172 | CD_DIR=$(apache_cd_dir) |
| 175 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
173 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
| 176 | |
174 | |
| 177 | MOD_FILE=$(apache_mod_file) |
175 | MOD_FILE=$(apache_mod_file) |
| 178 | |
176 | |
| 179 | exeinto ${APACHE1_MODULESDIR} |
177 | exeinto ${APACHE1_MODULESDIR} |
| 180 | doexe ${MOD_FILE} || die "internal ebuild error: \'${MOD_FILE}\' not found" |
178 | doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" |
| 181 | [ -n "${APACHE1_EXECFILES}" ] && doexe ${APACHE1_EXECFILES} |
179 | [ -n "${APACHE1_EXECFILES}" ] && doexe ${APACHE1_EXECFILES} |
| 182 | |
180 | |
| 183 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
181 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
| 184 | insinto ${APACHE1_MODULES_CONFDIR} |
182 | insinto ${APACHE1_MODULES_CONFDIR} |
| 185 | doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: \'${APACHE2_MOD_CONF}.conf\' not found." |
183 | doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE1_MOD_CONF}.conf' not found." |
| 186 | fi |
184 | fi |
| 187 | |
185 | |
| 188 | cd ${S} |
186 | cd ${S} |
| 189 | |
187 | |
| 190 | if [ -n "${DOCFILES}" ] ; then |
188 | if [ -n "${DOCFILES}" ] ; then |
| 191 | OTHER_DOCS=$(apache_doc_magic) |
189 | OTHER_DOCS=$(apache_doc_magic) |
| 192 | HTML_DOCS=$(apache_doc_magic html) |
190 | HTML_DOCS=$(apache_doc_magic html) |
| … | |
… | |
| 210 | einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." |
208 | einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." |
| 211 | einfo |
209 | einfo |
| 212 | fi |
210 | fi |
| 213 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
211 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
| 214 | einfo |
212 | einfo |
| 215 | einfo "Configuration file installed as ${APACHE1_MODULES_CONFDIR}/${APACHE1_MOD_CONF}.conf" |
213 | einfo "Configuration file installed as" |
|
|
214 | einfo " ${APACHE1_MODULES_CONFDIR}/$(basename ${APACHE1_MOD_CONF}).conf" |
| 216 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" |
215 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" |
| 217 | einfo |
216 | einfo |
| 218 | fi |
217 | fi |
| 219 | } |
218 | } |
| 220 | |
219 | |
| … | |
… | |
| 230 | ## know they need prefork, and then exit the build. |
229 | ## know they need prefork, and then exit the build. |
| 231 | #### |
230 | #### |
| 232 | apache2_pkg_setup() { |
231 | apache2_pkg_setup() { |
| 233 | debug-print-function apache2_pkg_setup |
232 | debug-print-function apache2_pkg_setup |
| 234 | |
233 | |
| 235 | if [ -n "${APACHE2_MT_UNSAFEE}" ]; then |
234 | if [ -n "${APACHE2_SAFE_MPMS}" ]; then |
| 236 | if [ "x${APACHE2_MT_UNSAFE}" != "no" ]; then |
|
|
| 237 | APACHE2_MPM_STYLE=`/usr/sbin/apxs2 -q MPM_NAME` |
|
|
| 238 | if [ "x$APACHE2_MPM_STYLE" != "xprefork" ]; then |
|
|
| 239 | eerror "You currently have Apache configured to use the." |
|
|
| 240 | eerror "$APACHE2_MPM_STYLE MPM style. The module you are" |
|
|
| 241 | eerror "trying to install is not currently thread-safe," |
|
|
| 242 | eerror "and will not work under your current configuraiton." |
|
|
| 243 | echo |
|
|
| 244 | eerror "If you still want to use the module, please reinstall" |
|
|
| 245 | eerror "Apache with mpm-prefork set." |
|
|
| 246 | |
235 | |
| 247 | epause |
236 | INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" |
| 248 | ebeep |
237 | |
| 249 | die Invalid Apache MPM style. |
238 | if hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then |
|
|
239 | INSTALLED_MPM_SAFE="yes" |
| 250 | fi |
240 | fi |
| 251 | fi |
241 | |
|
|
242 | if [ -z "${INSTALLED_MPM_SAFE}" ] ; then |
|
|
243 | eerror "The module you are trying to install (${PN})" |
|
|
244 | eerror "will only work with one of the following MPMs:" |
|
|
245 | eerror " ${APACHE2_SAFE_MPMS}" |
|
|
246 | eerror "You do not currently have any of these MPMs installed." |
|
|
247 | eerror "Please re-install apache with the correct mpm-* USE flag set." |
|
|
248 | die "No safe MPM installed." |
| 252 | fi |
249 | fi |
|
|
250 | |
|
|
251 | fi |
|
|
252 | |
| 253 | } |
253 | } |
| 254 | |
254 | |
| 255 | #### |
255 | #### |
| 256 | ## apache2_src_compile |
256 | ## apache2_src_compile |
| 257 | ## |
257 | ## |
| 258 | ## The default action is to call ${APXS2} with the value of |
258 | ## The default action is to call ${APXS2} with the value of |
| 259 | ## ${APXS2_ARGS}. If a module requires a different build setup |
259 | ## ${APXS2_ARGS}. If a module requires a different build setup |
| … | |
… | |
| 285 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
285 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
| 286 | |
286 | |
| 287 | MOD_FILE=$(apache_mod_file) |
287 | MOD_FILE=$(apache_mod_file) |
| 288 | |
288 | |
| 289 | exeinto ${APACHE2_MODULESDIR} |
289 | exeinto ${APACHE2_MODULESDIR} |
| 290 | doexe ${MOD_FILE} || die "internal ebuild error: \'${MOD_FILE}\' not found" |
290 | doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" |
| 291 | [ -n "${APACHE2_EXECFILES}" ] && doexe ${APACHE2_EXECFILES} |
291 | [ -n "${APACHE2_EXECFILES}" ] && doexe ${APACHE2_EXECFILES} |
| 292 | |
292 | |
| 293 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
293 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
| 294 | insinto ${APACHE2_MODULES_CONFDIR} |
294 | insinto ${APACHE2_MODULES_CONFDIR} |
| 295 | doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: \'${APACHE2_MOD_CONF}.conf\' not found." |
295 | doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE2_MOD_CONF}.conf' not found." |
| 296 | fi |
296 | fi |
| 297 | |
297 | |
| 298 | if [ -n "${APACHE2_VHOSTFILE}" ]; then |
298 | if [ -n "${APACHE2_VHOSTFILE}" ]; then |
| 299 | insinto ${APACHE2_MODULES_VHOSTDIR} |
299 | insinto ${APACHE2_MODULES_VHOSTDIR} |
| 300 | doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf |
300 | doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf |
| … | |
… | |
| 320 | einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." |
320 | einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." |
| 321 | einfo |
321 | einfo |
| 322 | fi |
322 | fi |
| 323 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
323 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
| 324 | einfo |
324 | einfo |
| 325 | einfo "Configuration file installed as ${APACHE2_MODULES_CONFDIR}/${APACHE2_MOD_CONF}.conf" |
325 | einfo "Configuration file installed as" |
|
|
326 | einfo " ${APACHE2_MODULES_CONFDIR}/$(basename ${APACHE2_MOD_CONF}).conf" |
| 326 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" |
327 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" |
| 327 | einfo |
328 | einfo |
| 328 | fi |
329 | fi |
|
|
330 | |
|
|
331 | if [ -n "${APACHE2_SAFE_MPMS}" ]; then |
|
|
332 | |
|
|
333 | INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" |
|
|
334 | |
|
|
335 | if ! hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then |
|
|
336 | INSTALLED_MPM_UNSAFE="${INSTALLED_MPM_UNSAFE} ${mpm}" |
|
|
337 | else |
|
|
338 | INSTALLED_MPM_SAFE="${INSTALLED_MPM_SAFE} ${mpm}" |
|
|
339 | fi |
|
|
340 | |
|
|
341 | if [ -n "${INSTALLED_MPM_UNSAFE}" ] ; then |
|
|
342 | ewarn "You have one or more MPMs installed that will not work with" |
|
|
343 | ewarn "this module (${PN}). Please make sure that you only enable" |
|
|
344 | ewarn "this module if you are using one of the following MPMs:" |
|
|
345 | ewarn " ${INSTALLED_MPM_SAFE}" |
|
|
346 | fi |
|
|
347 | |
|
|
348 | fi |
|
|
349 | |
| 329 | } |
350 | } |
| 330 | |
351 | |
| 331 | ###### |
352 | ###### |
| 332 | ## Apache dual (1.x or 2.x) ebuild functions |
353 | ## Apache dual (1.x or 2.x) ebuild functions |
| 333 | ## |
354 | ## |