1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.1 2007/11/28 13:04:12 hollow Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.3 2007/12/15 14:00:19 hollow Exp $ |
4 | |
4 | |
5 | # @ECLASS: apache-2 |
5 | # @ECLASS: apache-2 |
6 | # @MAINTAINER: apache-devs@gentoo.org |
6 | # @MAINTAINER: apache-devs@gentoo.org |
7 | # @BLURB: Provides a common set of functions for >=apache-2.2* ebuilds |
7 | # @BLURB: Provides a common set of functions for >=apache-2.2* ebuilds |
8 | # @DESCRIPTION: |
8 | # @DESCRIPTION: |
… | |
… | |
54 | # @DESCRIPTION: |
54 | # @DESCRIPTION: |
55 | # This variable needs to be set in the ebuild and contains a list of available |
55 | # This variable needs to be set in the ebuild and contains a list of available |
56 | # built-in modules |
56 | # built-in modules |
57 | |
57 | |
58 | IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" |
58 | IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" |
59 | IUSE="debug doc ldap selinux ssl static suexec threads" |
59 | IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads" |
60 | |
60 | |
61 | for module in ${IUSE_MODULES} ; do |
61 | for module in ${IUSE_MODULES} ; do |
62 | IUSE="${IUSE} apache2_modules_${module}" |
62 | IUSE="${IUSE} apache2_modules_${module}" |
63 | done |
63 | done |
64 | |
64 | |
… | |
… | |
130 | eerror "You have selected a non-threaded MPM but USE=threads is enabled" |
130 | eerror "You have selected a non-threaded MPM but USE=threads is enabled" |
131 | die "invalid use flag combination" |
131 | die "invalid use flag combination" |
132 | fi |
132 | fi |
133 | } |
133 | } |
134 | |
134 | |
|
|
135 | # @ECLASS-VARIABLE: MODULE_CRITICAL |
|
|
136 | # @DESCRIPTION: |
|
|
137 | # This variable needs to be set in the ebuild and contains a space-separated |
|
|
138 | # list of modules critical for the default apache. A user may still |
|
|
139 | # disable these modules for custom minimal installation at their own risk. |
|
|
140 | |
|
|
141 | # @FUNCTION: check_module_critical |
|
|
142 | # @DESCRIPTION: |
|
|
143 | # This internal function warns the user about modules critical for the default |
|
|
144 | # apache configuration. |
|
|
145 | check_module_critical() { |
|
|
146 | local unsupported=0 |
|
|
147 | |
|
|
148 | for m in ${MODULE_CRITICAL} ; do |
|
|
149 | if ! has ${m} ${MY_MODS} ; then |
|
|
150 | ewarn "Module '${m}' is required in the default apache configuration." |
|
|
151 | unsupported=1 |
|
|
152 | fi |
|
|
153 | done |
|
|
154 | |
|
|
155 | if [[ ${unsupported} -ne 0 ]] ; then |
|
|
156 | ewarn |
|
|
157 | ewarn "You have disabled one or more required modules" |
|
|
158 | ewarn "for the default apache configuration." |
|
|
159 | ewarn "Although this is not an error, please be" |
|
|
160 | ewarn "aware that this setup is UNSUPPORTED." |
|
|
161 | ewarn |
|
|
162 | ebeep 10 |
|
|
163 | fi |
|
|
164 | } |
|
|
165 | |
135 | # @ECLASS-VARIABLE: MODULE_DEPENDS |
166 | # @ECLASS-VARIABLE: MODULE_DEPENDS |
136 | # @DESCRIPTION: |
167 | # @DESCRIPTION: |
137 | # This variable needs to be set in the ebuild and contains a space-separated |
168 | # This variable needs to be set in the ebuild and contains a space-separated |
138 | # list of dependency tokens each with a module and the module it depends on |
169 | # list of dependency tokens each with a module and the module it depends on |
139 | # separated by a colon |
170 | # separated by a colon |
… | |
… | |
253 | done |
284 | done |
254 | |
285 | |
255 | # sort and uniquify MY_MODS |
286 | # sort and uniquify MY_MODS |
256 | MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u) |
287 | MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u) |
257 | check_module_depends |
288 | check_module_depends |
|
|
289 | check_module_critical |
258 | } |
290 | } |
259 | |
291 | |
260 | # @ECLASS-VARIABLE: MODULE_DEFINES |
292 | # @ECLASS-VARIABLE: MODULE_DEFINES |
261 | # @DESCRIPTION: |
293 | # @DESCRIPTION: |
262 | # This variable needs to be set in the ebuild and contains a space-separated |
294 | # This variable needs to be set in the ebuild and contains a space-separated |
… | |
… | |
309 | if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then |
341 | if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then |
310 | eerror "The previous configuration file for built-in modules" |
342 | eerror "The previous configuration file for built-in modules" |
311 | eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your" |
343 | eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your" |
312 | eerror "system." |
344 | eerror "system." |
313 | eerror |
345 | eerror |
314 | eerror "Please read http://www.gentoo.org/proj/en/apache/upgrade.xml" |
346 | eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml" |
315 | eerror "for detailed information how to convert this file to the new" |
347 | eerror "for detailed information how to convert this file to the new" |
316 | eerror "APACHE2_MODULES USE_EXPAND variable." |
348 | eerror "APACHE2_MODULES USE_EXPAND variable." |
317 | eerror |
349 | eerror |
318 | die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" |
350 | die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" |
319 | fi |
351 | fi |
… | |
… | |
348 | } |
380 | } |
349 | |
381 | |
350 | # @FUNCTION: apache-2_src_unpack |
382 | # @FUNCTION: apache-2_src_unpack |
351 | # @DESCRIPTION: |
383 | # @DESCRIPTION: |
352 | # This function applies patches, configures a custom file-system layout and |
384 | # This function applies patches, configures a custom file-system layout and |
353 | # rebuilds the configure scripts. The patch names are organized as follows: |
385 | # rebuilds the configure scripts. |
354 | # |
|
|
355 | # 00-19 Gentoo specific (00_all_some-title.patch) |
|
|
356 | # 20-39 Additional MPMs (20_all_${MPM}_some-title.patch) |
|
|
357 | # 40-59 USE-flag based (40_all_${USE}_some-title.patch) |
|
|
358 | # 60-79 Version specific (60_all_${PV}_some-title.patch) |
|
|
359 | # 80-99 Security patches (80_all_${PV}_cve-####-####.patch) |
|
|
360 | apache-2_src_unpack() { |
386 | apache-2_src_unpack() { |
361 | unpack ${A} |
387 | unpack ${A} |
362 | cd "${S}" |
388 | cd "${S}" |
363 | |
389 | |
364 | # Use correct multilib libdir in gentoo patches |
390 | # Use correct multilib libdir in gentoo patches |
… | |
… | |
371 | # setup the filesystem layout config |
397 | # setup the filesystem layout config |
372 | cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ |
398 | cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ |
373 | die "Failed preparing config.layout!" |
399 | die "Failed preparing config.layout!" |
374 | sed -i -e "s:version:${PF}:g" "${S}"/config.layout |
400 | sed -i -e "s:version:${PF}:g" "${S}"/config.layout |
375 | |
401 | |
|
|
402 | # apache2.8 instead of httpd.8 (bug #194828) |
|
|
403 | mv docs/man/{httpd,apache2}.8 |
|
|
404 | sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in |
|
|
405 | |
376 | # patched-in MPMs need the build environment rebuilt |
406 | # patched-in MPMs need the build environment rebuilt |
377 | sed -i -e '/sinclude/d' configure.in |
407 | sed -i -e '/sinclude/d' configure.in |
378 | AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf |
408 | AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf |
379 | |
|
|
380 | # apache2.8 instead of httpd.8 (bug #194828) |
|
|
381 | mv docs/man/{httpd,apache2}.8 |
|
|
382 | } |
409 | } |
383 | |
410 | |
384 | # @FUNCTION: apache-2_src_compile |
411 | # @FUNCTION: apache-2_src_compile |
385 | # @DESCRIPTION: |
412 | # @DESCRIPTION: |
386 | # This function adds compiler flags and runs econf and emake based on MY_MPM and |
413 | # This function adds compiler flags and runs econf and emake based on MY_MPM and |