diff options
author | Benedikt Boehm <hollow@gentoo.org> | 2007-11-25 14:27:52 +0000 |
---|---|---|
committer | Benedikt Boehm <hollow@gentoo.org> | 2007-11-25 14:27:52 +0000 |
commit | 79030832b973afedd47b381c841354c1dd0e9e13 (patch) | |
tree | 132dd649b588f02bc20ff27a3c8ebee8da2960f3 | |
parent | don't use command substitution (diff) | |
download | gentoo-2-79030832b973afedd47b381c841354c1dd0e9e13.tar.gz gentoo-2-79030832b973afedd47b381c841354c1dd0e9e13.tar.bz2 gentoo-2-79030832b973afedd47b381c841354c1dd0e9e13.zip |
remove deprecated apache1 functions; remove bogus need_apache logic; convert to standardized documentation comments
-rw-r--r-- | eclass/apache-module.eclass | 318 | ||||
-rw-r--r-- | eclass/depend.apache.eclass | 379 |
2 files changed, 230 insertions, 467 deletions
diff --git a/eclass/apache-module.eclass b/eclass/apache-module.eclass index 6fbbc3c81459..529729d2a9a5 100644 --- a/eclass/apache-module.eclass +++ b/eclass/apache-module.eclass @@ -1,89 +1,71 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.19 2007/05/12 02:28:51 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.20 2007/11/25 14:27:52 hollow Exp $ + +# @ECLASS: apache-module +# @MAINTAINER: apache-devs@gentoo.org +# @BLURB: Provides a common set of functions for apache modules +# @DESCRIPTION: +# This eclass handles apache modules in a sane way and providing information +# about where certain interfaces are located. +# +# @NOTE: If you use this, be sure you use the need_* call after you have defined +# DEPEND and RDEPEND. Also note that you can not rely on the automatic +# RDEPEND=DEPEND that Portage does if you use this eclass. +# +# See bug 107127 for more information. inherit depend.apache -# This eclass provides a common set of functions for Apache modules. - -# NOTE: If you use this, be sure you use the need_* call after you have -# defined DEPEND and RDEPEND. Also note that you can not rely on the -# automatic RDEPEND=DEPEND that Portage does if you use this eclass. -# See bug 107127 for more information. +# ============================================================================== +# INTERNAL VARIABLES +# ============================================================================== -###### -## Common ebuild variables -###### - -#### -## APXS1_S, APXS2_S -## -## Paths to temporary build directories -#### -APXS1_S="" +# @ECLASS-VARIABLE: APXS2_S +# @DESCRIPTION: +# Path to temporary build directory APXS2_S="" -#### -## APXS1_ARGS, APXS2_ARGS -## -## Arguments to pass to the apxs tool -#### -APXS1_ARGS="" +# @ECLASS-VARIABLE: APXS2_ARGS +# @DESCRIPTION: +# Arguments to pass to the apxs tool APXS2_ARGS="" -#### -## APACHE1_MOD_FILE, APACHE2_MOD_FILE -## -## Name of the module that src_install installs (only, minus the .so) -#### -APACHE1_MOD_FILE="" +# @ECLASS-VARIABLE: APACHE2_MOD_FILE +# @DESCRIPTION: +# Name of the module that src_install installs (minus the .so) APACHE2_MOD_FILE="" -#### -## APACHE1_MOD_CONF, APACHE2_MOD_CONF -## -## Configuration file installed by src_install -#### -APACHE1_MOD_CONF="" +# @ECLASS-VARIABLE: APACHE2_MOD_CONF +# @DESCRIPTION: +# Configuration file installed by src_install APACHE2_MOD_CONF="" -#### -## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE -## -## Name of define (eg FOO) to use in conditional loading of the installed -## module/it's config file, multiple defines should be space separated -#### -APACHE1_MOD_DEFINE="" +# @ECLASS-VARIABLE: APACHE2_MOD_DEFINE +# @DESCRIPTION: +# Name of define (eg FOO) to use in conditional loading of the installed +# module/it's config file, multiple defines should be space separated APACHE2_MOD_DEFINE="" -#### -## DOCFILES -## -## If the exported src_install() is being used, and ${DOCFILES} is non-zero, -## some sed-fu is applied to split out html documentation (if any) from normal -## documentation, and dodoc'd or dohtml'd -#### +# @ECLASS-VARIABLE: DOCFILES +# @DESCRIPTION: +# If the exported src_install() is being used, and ${DOCFILES} is non-zero, some +# sed-fu is applied to split out html documentation (if any) from normal +# documentation, and dodoc'd or dohtml'd DOCFILES="" -###### -## Utility functions -###### +# ============================================================================== +# PUBLIC FUNCTIONS +# ============================================================================== -#### -## apache_cd_dir -## -## Return the path to our temporary build dir -#### +# @FUNCTION: apache_cd_dir +# @DESCRIPTION: +# Return the path to our temporary build dir apache_cd_dir() { debug-print-function $FUNCNAME $* - if [[ "${APACHE_VERSION}" == "1" ]] ; then - [[ -n "${APXS1_S}" ]] && CD_DIR="${APXS1_S}" - else - [[ -n "${APXS2_S}" ]] && CD_DIR="${APXS2_S}" - fi + [[ -n "${APXS2_S}" ]] && CD_DIR="${APXS2_S}" - # XXX - Is this really needed? Can't we just return ${S}? if [[ -z "${CD_DIR}" ]] ; then if [[ -d "${S}/src" ]] ; then CD_DIR="${S}/src" @@ -96,34 +78,24 @@ apache_cd_dir() { echo "${CD_DIR}" } -#### -## apache_mod_file -## -## Return the path to the module file -#### +# @FUNCTION: apache_mod_file +# @DESCRIPTION: +# Return the path to the module file apache_mod_file() { debug-print-function $FUNCNAME $* - if [[ "${APACHE_VERSION}" == "1" ]] ; then - [[ -n "${APACHE1_MOD_FILE}" ]] && MOD_FILE="${APACHE1_MOD_FILE}" - [[ -z "${MOD_FILE}" ]] && MOD_FILE="$(apache_cd_dir)/${PN}.so" - else - [[ -n "${APACHE2_MOD_FILE}" ]] && MOD_FILE="${APACHE2_MOD_FILE}" - [[ -z "${MOD_FILE}" ]] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" - fi + [[ -n "${APACHE2_MOD_FILE}" ]] && MOD_FILE="${APACHE2_MOD_FILE}" + [[ -z "${MOD_FILE}" ]] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" debug-print apache_mod_file: "MOD_FILE=${MOD_FILE}" echo "${MOD_FILE}" } -#### -## apache_doc_magic -## -## Some magic for picking out html files from ${DOCFILES}. It takes -## an optional first argument `html'; if the first argument is equals -## `html', only html files are returned, otherwise normal (non-html) -## docs are returned. -#### +# @FUNCTION: apache_doc_magic +# @DESCRIPTION: +# Some magic for picking out html files from ${DOCFILES}. It takes an optional +# first argument `html'; if the first argument is equals `html', only html files +# are returned, otherwise normal (non-html) docs are returned. apache_doc_magic() { debug-print-function $FUNCNAME $* @@ -139,88 +111,11 @@ apache_doc_magic() { fi } -###### -## Apache 1.x ebuild functions - !!! DEPRECATED !!! -###### - -#### -## apache1_src_compile - !!! DEPRECATED !!! -#### -apache1_src_compile() { - debug-print-function $FUNCNAME $* - - CD_DIR=$(apache_cd_dir) - cd ${CD_DIR} || die "cd ${CD_DIR} failed" - APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}" - ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed" -} - -#### -## apache1_src_install - !!! DEPRECATED !!! -#### -apache1_src_install() { - debug-print-function $FUNCNAME $* - - CD_DIR=$(apache_cd_dir) - cd ${CD_DIR} || die "cd ${CD_DIR} failed" - - MOD_FILE=$(apache_mod_file) - - exeinto ${APACHE1_MODULESDIR} - doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" - [ -n "${APACHE1_EXECFILES}" ] && doexe ${APACHE1_EXECFILES} - - if [ -n "${APACHE1_MOD_CONF}" ] ; then - insinto ${APACHE1_MODULES_CONFDIR} - doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE1_MOD_CONF}.conf' not found." - fi - - cd ${S} - - if [ -n "${DOCFILES}" ] ; then - OTHER_DOCS=$(apache_doc_magic) - HTML_DOCS=$(apache_doc_magic html) - - [ -n "${OTHER_DOCS}" ] && dodoc ${OTHER_DOCS} - [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} - fi -} - -#### -## apache1_pkg_postinst - !!! DEPRECATED !!! -#### -apache1_pkg_postinst() { - debug-print-function $FUNCNAME $* - - if [ -n "${APACHE1_MOD_DEFINE}" ]; then - local my_opts="-D ${APACHE1_MOD_DEFINE// / -D }" - - einfo - einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache file and" - einfo "add '${my_opts}' to APACHE_OPTS." - einfo - fi - if [ -n "${APACHE1_MOD_CONF}" ] ; then - einfo - einfo "Configuration file installed as" - einfo " ${APACHE1_MODULES_CONFDIR}/$(basename ${APACHE1_MOD_CONF}).conf" - einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" - einfo - fi -} - -###### -## Apache 2.x ebuild functions -###### - -#### -## apache2_pkg_setup -## -## Checks to see if APACHE2_MT_UNSAFE is set to anything other than "no". If it is, then -## we check what the MPM style used by Apache is, if it isnt prefork, we let the user -## know they need prefork, and then exit the build. -#### -apache2_pkg_setup() { +# @FUNCTION: apache-module_pkg_setup +# @DESCRIPTION: +# Checks to see if APACHE2_SAFE_MPMS is set and if the currently installed MPM +# does appear in the list. +apache-module_pkg_setup() { debug-print-function $FUNCNAME $* if [[ -n "${APACHE2_SAFE_MPMS}" ]] ; then @@ -241,14 +136,12 @@ apache2_pkg_setup() { fi } -#### -## apache2_src_compile -## -## The default action is to call ${APXS2} with the value of -## ${APXS2_ARGS}. If a module requires a different build setup -## than this, use ${APXS2} in your own src_compile routine. -#### -apache2_src_compile() { +# @FUNCTION: apache-module_src_compile +# @DESCRIPTION: +# The default action is to call ${APXS2} with the value of ${APXS2_ARGS}. If a +# module requires a different build setup than this, use ${APXS2} in your own +# src_compile routine. +apache-module_src_compile() { debug-print-function $FUNCNAME $* CD_DIR=$(apache_cd_dir) @@ -257,17 +150,16 @@ apache2_src_compile() { ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed" } -#### -## apache2_src_install -## -## This installs the files into apache's directories. The module is installed -## from a directory chosen as above (APXS2_S or ${S}/src). In addition, -## this function can also set the executable permission on files listed in EXECFILES. -## The configuration file name is listed in CONFFILE without the .conf extensions, -## so if you configuration is 55_mod_foo.conf, CONFFILE would be 55_mod_foo. -## DOCFILES contains the list of files you want filed as documentation. -#### -apache2_src_install() { +# @FUNCTION: apache-module_src_install +# @DESCRIPTION: +# This installs the files into apache's directories. The module is installed +# from a directory chosen as above (APXS2_S or ${S}/src). In addition, this +# function can also set the executable permission on files listed in +# APACHE2_EXECFILES. The configuration file name is listed in APACHE2_MOD_CONF +# without the .conf extensions, so if you configuration is 55_mod_foo.conf, +# APACHE2_MOD_CONF would be 55_mod_foo. DOCFILES contains the list of files you +# want filed as documentation. +apache-module_src_install() { debug-print-function $FUNCNAME $* CD_DIR=$(apache_cd_dir) @@ -300,7 +192,10 @@ apache2_src_install() { fi } -apache2_pkg_postinst() { +# @FUNCTION: apache-module_pkg_postinst +# @DESCRIPTION: +# This prints out information about the installed module and how to enable it. +apache-module_pkg_postinst() { debug-print-function $FUNCNAME $* if [[ -n "${APACHE2_MOD_DEFINE}" ]] ; then @@ -330,59 +225,12 @@ apache2_pkg_postinst() { fi if [[ -n "${INSTALLED_MPM_UNSAFE}" ]] ; then - ewarn "You have one or more MPMs installed that will not work with" - ewarn "this module (${PN}). Please make sure that you only enable" - ewarn "this module if you are using one of the following MPMs:" + ewarn "Your installed MPM will not work with this module (${PN})." + ewarn "Please make sure that you only enable this module" + ewarn "if you are using one of the following MPMs:" ewarn " ${INSTALLED_MPM_SAFE}" fi fi } -###### -## Apache dual (1.x or 2.x) ebuild functions - Apache 1.X DEPRECATED! -## -## This is where the magic happens. We provide dummy routines of all of the functions -## provided by all of the specifics. We use APACHE_ECLASS_VER_* to see which versions -## to call. If a function is provided by a given section (ie pkg_postinst in Apache 2.x) -## the exported routine simply does nothing. -###### - -apache-module_pkg_setup() { - debug-print-function $FUNCNAME $* - - if [[ ${APACHE_VERSION} -eq "2" ]] ; then - apache2_pkg_setup - fi -} - -apache-module_src_compile() { - debug-print-function $FUNCNAME $* - - if [[ ${APACHE_VERSION} -eq "1" ]] ; then - apache1_src_compile - else - apache2_src_compile - fi -} - -apache-module_src_install() { - debug-print-function $FUNCNAME $* - - if [[ ${APACHE_VERSION} -eq "1" ]] ; then - apache1_src_install - else - apache2_src_install - fi -} - -apache-module_pkg_postinst() { - debug-print-function $FUNCNAME $* - - if [[ ${APACHE_VERSION} -eq "1" ]] ; then - apache1_pkg_postinst - else - apache2_pkg_postinst - fi -} - EXPORT_FUNCTIONS pkg_setup src_compile src_install pkg_postinst diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass index 63650bde349d..4cebfef54a68 100644 --- a/eclass/depend.apache.eclass +++ b/eclass/depend.apache.eclass @@ -1,184 +1,97 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.34 2007/09/08 14:06:12 hollow Exp $ - -inherit multilib +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.35 2007/11/25 14:27:52 hollow Exp $ +# @ECLASS: depend.apache.eclass +# @MAINTAINER: apache-devs@gentoo.org +# @BLURB: Functions to allow ebuilds to depend on apache +# @DESCRIPTION: # This eclass handles depending on apache in a sane way and providing # information about where certain interfaces are located. - -# NOTE: If you use this, be sure you use the need_* call after you have -# defined DEPEND and RDEPEND. Also note that you can not rely on the -# automatic RDEPEND=DEPEND that portage does if you use this eclass. +# +# @NOTE: If you use this, be sure you use the need_* call after you have defined +# DEPEND and RDEPEND. Also note that you can not rely on the automatic +# RDEPEND=DEPEND that portage does if you use this eclass. +# # See bug 107127 for more information. -###### -## Apache Common Variables -## -## These are internal variables used by this, and other apache-related eclasses, -## and thus should not need to be used by the ebuilds themselves (the ebuilds -## should know what version of Apache they are building against). -###### - -#### -## APACHE_VERSION -## -## Stores the version of apache we are going to be ebuilding. This variable is -## set by the need_apache{|1|2} functions. -## -#### +inherit multilib + +# ============================================================================== +# INTERNAL VARIABLES +# ============================================================================== + +# @ECLASS-VARIABLE: APACHE_VERSION +# @DESCRIPTION: +# Stores the version of apache we are going to be ebuilding. This variable is +# set by the need_apache functions. #APACHE_VERSION="2" -#### -## APXS1, APXS2 -## -## Paths to the apxs tools -#### -APXS1="/usr/sbin/apxs" +# @ECLASS-VARIABLE: APXS2 +# @DESCRIPTION: +# Paths to the apxs tool APXS2="/usr/sbin/apxs2" -#### -## APACHECTL1, APACHECTL2 -## -## Paths to the apachectl tools -#### -APACHECTL1="/usr/sbin/apachectl" +# @ECLASS-VARIABLE: APACHECTL2 +# @DESCRIPTION: +# Path to the apachectl tool APACHECTL2="/usr/sbin/apache2ctl" -#### -## APACHE1_BASEDIR, APACHE2_BASEDIR -## -## Paths to the server root directories -#### -APACHE1_BASEDIR="/usr/$(get_libdir)/apache" +# @ECLASS-VARIABLE: APACHE2_BASEDIR +# @DESCRIPTION: +# Path to the server root directory APACHE2_BASEDIR="/usr/$(get_libdir)/apache2" -#### -## APACHE1_CONFDIR, APACHE2_CONFDIR -## -## Paths to the configuration file directories -#### -APACHE1_CONFDIR="/etc/apache" +# @ECLASS-VARIABLE: APACHE2_CONFDIR +# @DESCRIPTION: +# Path to the configuration file directory APACHE2_CONFDIR="/etc/apache2" -#### -## APACHE1_MODULES_CONFDIR, APACHE2_MODULES_CONFDIR -## -## Paths where module configuration files are kept -#### -APACHE1_MODULES_CONFDIR="${APACHE1_CONFDIR}/modules.d" +# @ECLASS-VARIABLE: APACHE2_MODULES_CONFDIR +# @DESCRIPTION: +# Path where module configuration files are kept APACHE2_MODULES_CONFDIR="${APACHE2_CONFDIR}/modules.d" -#### -## APACHE1_VHOSTDIR, APACHE2_VHOSTDIR -## -## Paths where virtual host configuration files are kept -#### -APACHE1_VHOSTDIR="${APACHE1_CONFDIR}/vhosts.d" +# @ECLASS-VARIABLE: APACHE2_VHOSTDIR +# @DESCRIPTION: +# Path where virtual host configuration files are kept APACHE2_VHOSTDIR="${APACHE2_CONFDIR}/vhosts.d" -#### -## APACHE1_MODULESDIR, APACHE2_MODULESDIR -## -## Paths where we install modules -#### -APACHE1_MODULESDIR="${APACHE1_BASEDIR}/modules" +# @ECLASS-VARIABLE: APACHE2_MODULESDIR +# @DESCRIPTION: +# Path where we install modules APACHE2_MODULESDIR="${APACHE2_BASEDIR}/modules" -#### -## APACHE1_DEPEND, APACHE2_DEPEND -## APACHE2_0_DEPEND, APACHE2_2_DEPEND -## -## Dependencies for Apache 1.x and Apache 2.x -#### -APACHE1_DEPEND="=www-servers/apache-1*" +# @ECLASS-VARIABLE: APACHE2_DEPEND +# @DESCRIPTION: +# Dependencies for Apache 2.x APACHE2_DEPEND="=www-servers/apache-2*" + +# @ECLASS-VARIABLE: APACHE2_0_DEPEND +# @DESCRIPTION: +# Dependencies for Apache 2.0.x APACHE2_0_DEPEND="=www-servers/apache-2.0*" -APACHE2_2_DEPEND="=www-servers/apache-2.2*" -#### -## NEED_APACHE_DEPEND -## -## Dependency magic based on useflags to use the right DEPEND -## If you change this, please check the DEPENDS in need_apache() -#### +# @ECLASS-VARIABLE: APACHE2_2_DEPEND +# @DESCRIPTION: +# Dependencies for Apache 2.2.x +APACHE2_2_DEPEND="=www-servers/apache-2.2*" -NEED_APACHE_DEPEND="${APACHE2_DEPEND}" +# @ECLASS-VARIABLE: WANT_APACHE_DEPEND +# @DESCRIPTION: +# Dependency magic based on useflag to use the right DEPEND WANT_APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} )" -#### -## apr_config/apu_config -## -## Version magic to get the correct apr-config/apu-config -## based on the (probably) installed version of apache. -## This is needed to get modules to link to the same apr/apu -## as apache (i.e. link 0.9 for 2.0, 1.x for 2.2) -#### -apr_config() { - local default="${1:-1}" - if [[ "${USE_APACHE}" == "2" ]]; then - if has_version ${APACHE2_0_DEPEND}; then - echo apr-config - else - echo apr-1-config - fi - else - if [[ "${default}" == "0" ]]; then - echo apr-config - elif [[ "${default}" == "1" ]]; then - echo apr-1-config - else - die "Unknown version specifier: ${default}" - fi - fi -} - -apu_config() { - local default="${1:-1}" - if [[ "${USE_APACHE}" == "2" ]]; then - if has_version ${APACHE2_0_DEPEND}; then - echo apu-config - else - echo apu-1-config - fi - else - if [[ "${default}" == "0" ]]; then - echo apu-config - elif [[ "${default}" == "1" ]]; then - echo apu-1-config - else - die "Unknown version specifier: ${default}" - fi - fi -} - -#### -# uses_apache1() - !!! DEPRECATED !!! -#### - -uses_apache1() { - debug-print-function $FUNCNAME $* - # WARNING: Do not use these variables with anything that is put - # into the dependency cache (DEPEND/RDEPEND/etc) - APACHE_VERSION="1" - APXS="${APXS1}" - USE_APACHE="1" - APACHECTL="${APACHECTL1}" - APACHE_BASEDIR="${APACHE1_BASEDIR}" - APACHE_CONFDIR="${APACHE1_CONFDIR}" - APACHE_MODULES_CONFDIR="${APACHE1_MODULES_CONFDIR}" - APACHE_VHOSTSDIR="${APACHE1_VHOSTSDIR}" - APACHE_MODULESDIR="${APACHE1_MODULESDIR}" -} - -#### -# uses_apache2() -# -# sets up all of the environment variables required by an apache2 module -#### +# ============================================================================== +# INTERNAL FUNCTIONS +# ============================================================================== +# @FUNCTION: uses_apache2 +# @DESCRIPTION: +# sets up all of the environment variables required for an apache2 module uses_apache2() { debug-print-function $FUNCNAME $* + # WARNING: Do not use these variables with anything that is put # into the dependency cache (DEPEND/RDEPEND/etc) APACHE_VERSION="2" @@ -192,129 +105,131 @@ uses_apache2() { APACHE_MODULESDIR="${APACHE2_MODULESDIR}" } +# @FUNCTION: doesnt_use_apache +# @DESCRIPTION: +# sets up all of the environment variables required for optional apache usage doesnt_use_apache() { debug-print-function $FUNCNAME $* + APACHE_VERSION="0" USE_APACHE="0" } -#### -## need_apache1 - !!! DEPRECATED !!! -#### -need_apache1() { +# ============================================================================== +# PUBLIC FUNCTIONS +# ============================================================================== + +# @FUNCTION: want_apache +# @DESCRIPTION: +# An ebuild calls this to get the dependency information for optional apache-2.x +# support. +want_apache() { debug-print-function $FUNCNAME $* - DEPEND="${DEPEND} ${APACHE1_DEPEND}" - RDEPEND="${RDEPEND} ${APACHE1_DEPEND}" - APACHE_VERSION="1" + IUSE="${IUSE} apache2" + DEPEND="${DEPEND} ${WANT_APACHE_DEPEND}" + RDEPEND="${RDEPEND} ${WANT_APACHE_DEPEND}" + + if use apache2 ; then + uses_apache2 + else + doesnt_use_apache + fi } -#### -## need_apache2 -## -## An ebuild calls this to get the dependency information -## for apache-2.x. An ebuild should use this in order for -## future changes to the build infrastructure to happen -## seamlessly. All an ebuild needs to do is include the -## line need_apache2 somewhere. -#### +# @FUNCTION: need_apache2 +# @DESCRIPTION: +# An ebuild calls this to get the dependency information for apache-2.x. An +# ebuild should use this in order for future changes to the build infrastructure +# to happen seamlessly. All an ebuild needs to do is include the line +# need_apache2 somewhere. need_apache2() { debug-print-function $FUNCNAME $* DEPEND="${DEPEND} ${APACHE2_DEPEND}" RDEPEND="${RDEPEND} ${APACHE2_DEPEND}" - APACHE_VERSION="2" + uses_apache2 } -#### -## need_apache2_0 -## -## Works like need_apache2 above, but its used by modules -## that only support apache 2.0 and do not work with -## higher versions. -## -#### +# @FUNCTION: need_apache2_0 +# @DESCRIPTION: +# Works like need_apache2 above, but its used by modules that only support +# apache 2.0 and do not work with higher versions. need_apache2_0() { debug-print-function $FUNCNAME $* DEPEND="${DEPEND} ${APACHE2_0_DEPEND}" RDEPEND="${RDEPEND} ${APACHE2_0_DEPEND}" - APACHE_VERSION="2" + uses_apache2 } -#### -## need_apache2_2 -## -## Works like need_apache2 above, but its used by modules -## that only support apache 2.2 and do not work with -## lower versions. -## -#### +# @FUNCTION: need_apache2_2 +# @DESCRIPTION: +# Works like need_apache2 above, but its used by modules that only support +# apache 2.2 and do not work with lower versions. need_apache2_2() { debug-print-function $FUNCNAME $* DEPEND="${DEPEND} ${APACHE2_2_DEPEND}" RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}" - APACHE_VERSION="2" + uses_apache2 } -#### -## DO NOT CHANGE THIS FUNCTION UNLESS YOU UNDERSTAND THE CONSEQUENCES IT -## WILL HAVE ON THE CACHE! -## -## This function can take a variable amount of arguments specifying the -## versions of apache the ebuild supports -## -## If no arguments are specified, then all versions are assumed to be supported -## -## Currently supported versions: 2.0 2.2 2.x -#### +# @FUNCTION: need_apache +# @DESCRIPTION: +# Legacy alias for need_apache2 need_apache() { - debug-print-function $FUNCNAME $* + need_apache2 +} - local supports2x supports20 supports22 +# @FUNCTION: apr_config +# @DESCRIPTION: +# Version magic to get the correct apr-config binary based on the (probably) +# installed version of apache. This is needed to get modules to link to the +# same apr/apu as apache (i.e. link 0.9 for 2.0, 1.x for 2.2) +apr_config() { + debug-print-function $FUNCNAME $* - if [[ $# -eq 0 ]] ; then - supports2x="yes" + local default="${1:-1}" + if [[ "${USE_APACHE}" == "2" ]]; then + if has_version ${APACHE2_0_DEPEND}; then + echo apr-config + else + echo apr-1-config + fi else - while [[ $# -gt 0 ]] ; do - case "$1" in - 2.0) supports20="yes"; shift;; - 2.2) supports22="yes"; shift;; - 2.x) supports2x="yes"; shift;; - *) die "Unknown version specifier: $1";; - esac - done - fi - - if [[ "${supports20}" == "yes" ]] && [[ "${supports22}" == "yes" ]] ; then - supports2x="yes" - fi - - debug-print "supports20: ${supports20}" - debug-print "supports22: ${supports22}" - debug-print "supports2x: ${supports2x}" - - if [[ "${supports2x}" == "yes" ]] ; then - need_apache2 - elif [[ "${supports20}" == "yes" ]] ; then - need_apache2_0 - elif [[ "${supports22}" == "yes" ]] ; then - need_apache2_2 + if [[ "${default}" == "0" ]]; then + echo apr-config + elif [[ "${default}" == "1" ]]; then + echo apr-1-config + else + die "Unknown version specifier: ${default}" + fi fi - - uses_apache2 } -want_apache() { +# @FUNCTION: apu_config +# @DESCRIPTION: +# Version magic to get the correct apu-config binary based on the (probably) +# installed version of apache. This is needed to get modules to link to the +# same apr/apu as apache (i.e. link 0.9 for 2.0, 1.x for 2.2) +apu_config() { debug-print-function $FUNCNAME $* - IUSE="${IUSE} apache2" - DEPEND="${DEPEND} ${WANT_APACHE_DEPEND}" - RDEPEND="${RDEPEND} ${WANT_APACHE_DEPEND}" - if use apache2 ; then - uses_apache2 + local default="${1:-1}" + if [[ "${USE_APACHE}" == "2" ]]; then + if has_version ${APACHE2_0_DEPEND}; then + echo apu-config + else + echo apu-1-config + fi else - doesnt_use_apache + if [[ "${default}" == "0" ]]; then + echo apu-config + elif [[ "${default}" == "1" ]]; then + echo apu-1-config + else + die "Unknown version specifier: ${default}" + fi fi } |