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

Diff of /eclass/apache-2.eclass

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

Revision 1.1 Revision 1.6
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.6 2008/01/16 10:47:45 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
58IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" 58IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
59IUSE="debug doc ldap selinux ssl static suexec threads" 59IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
60 60
61for module in ${IUSE_MODULES} ; do 61for module in ${IUSE_MODULES} ; do
62 IUSE="${IUSE} apache2_modules_${module}" 62 IUSE="${IUSE} apache2_modules_${module}"
63done 63done
64 64
90# @FUNCTION: setup_mpm 90# @FUNCTION: setup_mpm
91# @DESCRIPTION: 91# @DESCRIPTION:
92# This internal function makes sure that only one of APACHE2_MPMS was selected 92# This internal function makes sure that only one of APACHE2_MPMS was selected
93# or a default based on USE=threads is selected if APACHE2_MPMS is empty 93# or a default based on USE=threads is selected if APACHE2_MPMS is empty
94setup_mpm() { 94setup_mpm() {
95 MY_MPM=""
95 for x in ${IUSE_MPMS} ; do 96 for x in ${IUSE_MPMS} ; do
96 if use apache2_mpms_${x} ; then 97 if use apache2_mpms_${x} ; then
97 if [[ -z "${MY_MPM}" ]] ; then 98 if [[ -z "${MY_MPM}" ]] ; then
98 MY_MPM=${x} 99 MY_MPM=${x}
99 elog 100 elog
130 eerror "You have selected a non-threaded MPM but USE=threads is enabled" 131 eerror "You have selected a non-threaded MPM but USE=threads is enabled"
131 die "invalid use flag combination" 132 die "invalid use flag combination"
132 fi 133 fi
133} 134}
134 135
136# @ECLASS-VARIABLE: MODULE_CRITICAL
137# @DESCRIPTION:
138# This variable needs to be set in the ebuild and contains a space-separated
139# list of modules critical for the default apache. A user may still
140# disable these modules for custom minimal installation at their own risk.
141
142# @FUNCTION: check_module_critical
143# @DESCRIPTION:
144# This internal function warns the user about modules critical for the default
145# apache configuration.
146check_module_critical() {
147 local unsupported=0
148
149 for m in ${MODULE_CRITICAL} ; do
150 if ! has ${m} ${MY_MODS} ; then
151 ewarn "Module '${m}' is required in the default apache configuration."
152 unsupported=1
153 fi
154 done
155
156 if [[ ${unsupported} -ne 0 ]] ; then
157 ewarn
158 ewarn "You have disabled one or more required modules"
159 ewarn "for the default apache configuration."
160 ewarn "Although this is not an error, please be"
161 ewarn "aware that this setup is UNSUPPORTED."
162 ewarn
163 ebeep 10
164 fi
165}
166
135# @ECLASS-VARIABLE: MODULE_DEPENDS 167# @ECLASS-VARIABLE: MODULE_DEPENDS
136# @DESCRIPTION: 168# @DESCRIPTION:
137# This variable needs to be set in the ebuild and contains a space-separated 169# 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 170# list of dependency tokens each with a module and the module it depends on
139# separated by a colon 171# separated by a colon
253 done 285 done
254 286
255 # sort and uniquify MY_MODS 287 # sort and uniquify MY_MODS
256 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u) 288 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
257 check_module_depends 289 check_module_depends
290 check_module_critical
258} 291}
259 292
260# @ECLASS-VARIABLE: MODULE_DEFINES 293# @ECLASS-VARIABLE: MODULE_DEFINES
261# @DESCRIPTION: 294# @DESCRIPTION:
262# This variable needs to be set in the ebuild and contains a space-separated 295# This variable needs to be set in the ebuild and contains a space-separated
309 if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then 342 if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then
310 eerror "The previous configuration file for built-in modules" 343 eerror "The previous configuration file for built-in modules"
311 eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your" 344 eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your"
312 eerror "system." 345 eerror "system."
313 eerror 346 eerror
314 eerror "Please read http://www.gentoo.org/proj/en/apache/upgrade.xml" 347 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" 348 eerror "for detailed information how to convert this file to the new"
316 eerror "APACHE2_MODULES USE_EXPAND variable." 349 eerror "APACHE2_MODULES USE_EXPAND variable."
317 eerror 350 eerror
318 die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" 351 die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
319 fi 352 fi
348} 381}
349 382
350# @FUNCTION: apache-2_src_unpack 383# @FUNCTION: apache-2_src_unpack
351# @DESCRIPTION: 384# @DESCRIPTION:
352# This function applies patches, configures a custom file-system layout and 385# This function applies patches, configures a custom file-system layout and
353# rebuilds the configure scripts. The patch names are organized as follows: 386# 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)
360apache-2_src_unpack() { 387apache-2_src_unpack() {
361 unpack ${A} 388 unpack ${A}
362 cd "${S}" 389 cd "${S}"
363 390
364 # Use correct multilib libdir in gentoo patches 391 # Use correct multilib libdir in gentoo patches
371 # setup the filesystem layout config 398 # setup the filesystem layout config
372 cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ 399 cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
373 die "Failed preparing config.layout!" 400 die "Failed preparing config.layout!"
374 sed -i -e "s:version:${PF}:g" "${S}"/config.layout 401 sed -i -e "s:version:${PF}:g" "${S}"/config.layout
375 402
403 # apache2.8 instead of httpd.8 (bug #194828)
404 mv docs/man/{httpd,apache2}.8
405 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
406
376 # patched-in MPMs need the build environment rebuilt 407 # patched-in MPMs need the build environment rebuilt
377 sed -i -e '/sinclude/d' configure.in 408 sed -i -e '/sinclude/d' configure.in
378 AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf 409 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} 410}
383 411
384# @FUNCTION: apache-2_src_compile 412# @FUNCTION: apache-2_src_compile
385# @DESCRIPTION: 413# @DESCRIPTION:
386# This function adds compiler flags and runs econf and emake based on MY_MPM and 414# This function adds compiler flags and runs econf and emake based on MY_MPM and
422# @FUNCTION: apache-2_src_install 450# @FUNCTION: apache-2_src_install
423# @DESCRIPTION: 451# @DESCRIPTION:
424# This function runs emake install and generates, install and adapts the gentoo 452# This function runs emake install and generates, install and adapts the gentoo
425# specific configuration files found in the tarball 453# specific configuration files found in the tarball
426apache-2_src_install() { 454apache-2_src_install() {
427 emake DESTDIR="${D}" install || die "emake install failed" 455 make DESTDIR="${D}" install || die "make install failed"
428 456
429 # install our configuration files 457 # install our configuration files
430 keepdir /etc/apache2/vhosts.d 458 keepdir /etc/apache2/vhosts.d
431 keepdir /etc/apache2/modules.d 459 keepdir /etc/apache2/modules.d
432 460
451 newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2 479 newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
452 480
453 # link apache2ctl to the init script 481 # link apache2ctl to the init script
454 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl 482 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
455 483
456 # provide symlinks for all the stuff we no longer rename, bug 177697 484 # provide legacy symlink for apxs, bug 177697
457 for i in suexec apxs; do
458 dosym /usr/sbin/${i} /usr/sbin/${i}2 485 dosym /usr/sbin/apxs /usr/sbin/apxs2
459 done
460 486
461 # install some thirdparty scripts 487 # install some thirdparty scripts
462 exeinto /usr/sbin 488 exeinto /usr/sbin
463 use ssl && doexe "${GENTOO_PATCHDIR}"/scripts/gentestcrt.sh 489 use ssl && doexe "${GENTOO_PATCHDIR}"/scripts/gentestcrt.sh
464 490
482 508
483 # set some sane permissions for suexec 509 # set some sane permissions for suexec
484 if use suexec ; then 510 if use suexec ; then
485 fowners 0:apache /usr/sbin/suexec 511 fowners 0:apache /usr/sbin/suexec
486 fperms 4710 /usr/sbin/suexec 512 fperms 4710 /usr/sbin/suexec
513 # provide legacy symlink for suexec, bug 177697
514 dosym /usr/sbin/suexec /usr/sbin/suexec2
487 fi 515 fi
488 516
489 # empty dirs 517 # empty dirs
490 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do 518 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
491 keepdir ${i} 519 keepdir ${i}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20