diff options
author | Andreas K. Hüttel <dilfridge@gentoo.org> | 2016-12-10 20:13:12 +0100 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2016-12-10 20:13:12 +0100 |
commit | 9615620d806470ea6a777d759614f274cbf9a51b (patch) | |
tree | af3eddf738abc1d2e42dfb4e68beb39b06e3f04d /eclass | |
parent | depend.apache.eclass: Disallow thread checks for EAPIs without use dependencies (diff) | |
download | dilfridge-9615620d806470ea6a777d759614f274cbf9a51b.tar.gz dilfridge-9615620d806470ea6a777d759614f274cbf9a51b.tar.bz2 dilfridge-9615620d806470ea6a777d759614f274cbf9a51b.zip |
eclass moved to main tree
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/apache-module.eclass | 239 | ||||
-rw-r--r-- | eclass/depend.apache.eclass | 381 |
2 files changed, 0 insertions, 620 deletions
diff --git a/eclass/apache-module.eclass b/eclass/apache-module.eclass deleted file mode 100644 index 16fbddd..0000000 --- a/eclass/apache-module.eclass +++ /dev/null @@ -1,239 +0,0 @@ -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# @ECLASS: apache-module.eclass -# @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. -# -# To make use of this eclass simply call one of the need/want_apache functions -# described in depend.apache.eclass. Make sure you use the need/want_apache 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. -# -# @EXAMPLE: -# -# Here is a simple example of an ebuild for mod_foo: -# -# @CODE -# APACHE2_MOD_CONF="42_mod_foo" -# APACHE2_MOD_DEFINE="FOO" -# need_apache2 -# @CODE -# -# A more complicated example for a module with non-standard locations: -# -# @CODE -# APXS2_S="${S}/apache22/src" -# APACHE2_MOD_FILE="${APXS2_S}/${PN}.so" -# APACHE2_MOD_CONF="42_${PN}" -# APACHE2_MOD_DEFINE="FOO" -# DOCFILES="docs/*.html" -# need_apache2_2 -# @CODE -# -# A basic module configuration which just loads the module into apache: -# -# @CODE -# <IfDefine FOO> -# LoadModule foo_module modules/mod_foo.so -# </IfDefine> -# @CODE - -inherit depend.apache - -# ============================================================================== -# PUBLIC VARIABLES -# ============================================================================== - -# @VARIABLE: APXS2_S -# @DESCRIPTION: -# Path to temporary build directory. (Defaults to `${S}/src' if it exists, -# `${S}' otherwise) - -# @VARIABLE: APXS2_ARGS -# @DESCRIPTION: -# Arguments to pass to the apxs tool. (Defaults to `-c ${PN}.c') - -# @VARIABLE: APACHE2_EXECFILES -# @DESCRIPTION: -# List of files that will be installed into ${APACHE_MODULE_DIR} beside -# ${APACHE2_MOD_FILE}. In addition, this function also sets the executable -# permission on those files. - -# @VARIABLE: APACHE2_MOD_CONF -# @DESCRIPTION: -# Module configuration file installed by src_install (minus the .conf suffix and -# relative to ${FILESDIR}). - -# @VARIABLE: APACHE2_MOD_DEFINE -# @DESCRIPTION: -# Name of define (e.g. FOO) to use in conditional loading of the installed -# module/its config file, multiple defines should be space separated. - -# @VARIABLE: APACHE2_MOD_FILE -# @DESCRIPTION: -# Name of the module that src_install installs minus the .so suffix. (Defaults -# to `${APXS2_S}/.libs/${PN}.so') - -# @VARIABLE: APACHE2_VHOST_CONF -# @DESCRIPTION: -# Virtual host configuration file installed by src_install (minus the .conf -# suffix and relative to ${FILESDIR}). - -# @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. - -# ============================================================================== -# INTERNAL FUNCTIONS -# ============================================================================== - -# Internal function to construct the default ${APXS2_S} path if required. -apache_cd_dir() { - debug-print-function $FUNCNAME $* - - local CD_DIR="${APXS2_S}" - - if [[ -z "${CD_DIR}" ]] ; then - if [[ -d "${S}/src" ]] ; then - CD_DIR="${S}/src" - else - CD_DIR="${S}" - fi - fi - - debug-print $FUNCNAME "CD_DIR=${CD_DIR}" - echo "${CD_DIR}" -} - -# Internal function to construct the default ${APACHE2_MOD_FILE} if required. -apache_mod_file() { - debug-print-function $FUNCNAME $* - - local MOD_FILE="${APACHE2_MOD_FILE:-$(apache_cd_dir)/.libs/${PN}.so}" - - debug-print $FUNCNAME "MOD_FILE=${MOD_FILE}" - echo "${MOD_FILE}" -} - -# Internal function 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 $* - - local DOCS= - - if [[ -n "${DOCFILES}" ]] ; then - if [[ "x$1" == "xhtml" ]] ; then - DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`" - else - DOCS="`echo ${DOCFILES} | sed 's, *[^ ]*\+.html, ,g'`" - fi - fi - - debug-print $FUNCNAME "DOCS=${DOCS}" - echo "${DOCS}" -} - -# ============================================================================== -# EXPORTED FUNCTIONS -# ============================================================================== - -# @FUNCTION: apache-module_src_compile -# @DESCRIPTION: -# The default action is to call ${APXS} with the value of ${APXS2_ARGS}. If a -# module requires a different build setup than this, use ${APXS} in your own -# src_compile routine. -apache-module_src_compile() { - debug-print-function $FUNCNAME $* - - local CD_DIR=$(apache_cd_dir) - cd "${CD_DIR}" || die "cd ${CD_DIR} failed" - - APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" - ${APXS} ${APXS2_ARGS} || die "${APXS} ${APXS2_ARGS} failed" -} - -# @FUNCTION: apache-module_src_install -# @DESCRIPTION: -# This installs the files into apache's directories. The module is installed -# from a directory chosen as above (apache_cd_dir). 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 $* - - local CD_DIR=$(apache_cd_dir) - pushd "${CD_DIR}" >/dev/null || die "cd ${CD_DIR} failed" - - local MOD_FILE=$(apache_mod_file) - - exeinto "${APACHE_MODULESDIR}" - doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" - [[ -n "${APACHE2_EXECFILES}" ]] && doexe ${APACHE2_EXECFILES} - - if [[ -n "${APACHE2_MOD_CONF}" ]] ; then - insinto "${APACHE_MODULES_CONFDIR}" - set -- ${APACHE2_MOD_CONF} - newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf" \ - || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found" - fi - - if [[ -n "${APACHE2_VHOST_CONF}" ]] ; then - insinto "${APACHE_VHOSTS_CONFDIR}" - set -- ${APACHE2_VHOST_CONF} - newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf " \ - || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found" - fi - - cd "${S}" - - if [[ -n "${DOCFILES}" ]] ; then - local OTHER_DOCS=$(apache_doc_magic) - local HTML_DOCS=$(apache_doc_magic html) - - [[ -n "${OTHER_DOCS}" ]] && dodoc ${OTHER_DOCS} - [[ -n "${HTML_DOCS}" ]] && dohtml ${HTML_DOCS} - fi - - popd >/dev/null -} - -# @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 - local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }" - - einfo - einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and" - einfo "add '${my_opts}' to APACHE2_OPTS." - einfo - fi - - if [[ -n "${APACHE2_MOD_CONF}" ]] ; then - set -- ${APACHE2_MOD_CONF} - einfo - einfo "Configuration file installed as" - einfo " ${APACHE_MODULES_CONFDIR}/$(basename ${2:-$1}).conf" - einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" - einfo - fi -} - -EXPORT_FUNCTIONS src_compile src_install pkg_postinst diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass deleted file mode 100644 index ba08318..0000000 --- a/eclass/depend.apache.eclass +++ /dev/null @@ -1,381 +0,0 @@ -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# @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 provides information -# about where certain binaries and configuration files are located. -# -# To make use of this eclass simply call one of the need/want_apache functions -# described below. Make sure you use the need/want_apache 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. -# -# @EXAMPLE: -# -# Here is an example of an ebuild depending on apache: -# -# @CODE -# DEPEND="virtual/Perl-CGI" -# RDEPEND="${DEPEND}" -# need_apache2 -# @CODE -# -# Another example which demonstrates non-standard IUSE options for optional -# apache support: -# -# @CODE -# DEPEND="server? ( virtual/Perl-CGI )" -# RDEPEND="${DEPEND}" -# want_apache2 server -# -# pkg_setup() { -# depend.apache_pkg_setup server -# } -# @CODE - -case ${EAPI:-0} in - 0|2|3|4|5) - inherit multilib - ;; - 6) - ;; - *) - die "EAPI=${EAPI} is not supported by depend.apache.eclass" - ;; -esac - -# ============================================================================== -# INTERNAL VARIABLES -# ============================================================================== - -# @ECLASS-VARIABLE: APACHE_VERSION -# @DESCRIPTION: -# Stores the version of apache we are going to be ebuilding. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APXS -# @DESCRIPTION: -# Path to the apxs tool. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_BIN -# @DESCRIPTION: -# Path to the apache binary. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_CTL -# @DESCRIPTION: -# Path to the apachectl tool. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_BASEDIR -# @DESCRIPTION: -# Path to the server root directory. -# This variable is set by the want/need_apache functions (EAPI=0 through 5) -# or depend.apache_pkg_setup (EAPI=6 and later). - -# @ECLASS-VARIABLE: APACHE_CONFDIR -# @DESCRIPTION: -# Path to the configuration file directory. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR -# @DESCRIPTION: -# Path where module configuration files are kept. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR -# @DESCRIPTION: -# Path where virtual host configuration files are kept. -# This variable is set by the want/need_apache functions. - -# @ECLASS-VARIABLE: APACHE_MODULESDIR -# @DESCRIPTION: -# Path where we install modules. -# This variable is set by the want/need_apache functions (EAPI=0 through 5) -# or depend.apache_pkg_setup (EAPI=6 and later). - -# @ECLASS-VARIABLE: APACHE_DEPEND -# @DESCRIPTION: -# Dependencies for Apache -APACHE_DEPEND="www-servers/apache" - -# @ECLASS-VARIABLE: APACHE2_DEPEND -# @DESCRIPTION: -# Dependencies for Apache 2.x -APACHE2_DEPEND="=www-servers/apache-2*" - -# @ECLASS-VARIABLE: APACHE2_2_DEPEND -# @DESCRIPTION: -# Dependencies for Apache 2.2.x -APACHE2_2_DEPEND="=www-servers/apache-2.2*" - -# @ECLASS-VARIABLE: APACHE2_4_DEPEND -# @DESCRIPTION: -# Dependencies for Apache 2.4.x -APACHE2_4_DEPEND="=www-servers/apache-2.4*" - - -# ============================================================================== -# INTERNAL FUNCTIONS -# ============================================================================== - -_init_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" - APXS="/usr/sbin/apxs2" - APACHE_BIN="/usr/sbin/apache2" - APACHE_CTL="/usr/sbin/apache2ctl" - APACHE_INCLUDEDIR="/usr/include/apache2" - APACHE_CONFDIR="/etc/apache2" - APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d" - APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d" - - case ${EAPI:-0} in - 0|2|3|4|5) - _init_apache2_late - ;; - esac -} - -_init_apache2_late() { - APACHE_BASEDIR="/usr/$(get_libdir)/apache2" - APACHE_MODULESDIR="${APACHE_BASEDIR}/modules" -} - -_init_no_apache() { - debug-print-function $FUNCNAME $* - APACHE_VERSION="0" -} - -# ============================================================================== -# PUBLIC FUNCTIONS -# ============================================================================== - -# @FUNCTION: depend.apache_pkg_setup -# @USAGE: [myiuse] -# @DESCRIPTION: -# An ebuild calls this in pkg_setup() to initialize variables for optional -# apache-2.x support. If the myiuse parameter is not given it defaults to -# apache2. -depend.apache_pkg_setup() { - debug-print-function $FUNCNAME $* - - if [[ "${EBUILD_PHASE}" != "setup" ]]; then - die "$FUNCNAME() should be called in pkg_setup()" - fi - - local myiuse=${1:-apache2} - - case ${EAPI:-0} in - 0|2|3|4|5) - if has ${myiuse} ${IUSE}; then - if use ${myiuse}; then - _init_apache2 - else - _init_no_apache - fi - fi - ;; - *) - if in_iuse ${myiuse}; then - if use ${myiuse}; then - _init_apache2 - _init_apache2_late - else - _init_no_apache - fi - fi - ;; - esac -} - -# @FUNCTION: want_apache -# @USAGE: [myiuse] -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for optional apache -# support. If the myiuse parameter is not given it defaults to apache2. -# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup() -# with the same myiuse parameter. -want_apache() { - debug-print-function $FUNCNAME $* - want_apache2 "$@" -} - -# @FUNCTION: want_apache2 -# @USAGE: [myiuse] -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for optional apache-2.x -# support. If the myiuse parameter is not given it defaults to apache2. -# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup() -# with the same myiuse parameter. -want_apache2() { - debug-print-function $FUNCNAME $* - - local myiuse=${1:-apache2} - IUSE="${IUSE} ${myiuse}" - DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" - RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )" -} - -# @FUNCTION: want_apache2_2 -# @USAGE: [myiuse] -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for optional -# apache-2.2.x support. If the myiuse parameter is not given it defaults to -# apache2. -# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup() -# with the same myiuse parameter. -want_apache2_2() { - debug-print-function $FUNCNAME $* - - local myiuse=${1:-apache2} - IUSE="${IUSE} ${myiuse}" - DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" - RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )" -} - -# @FUNCTION: want_apache2_4 -# @USAGE: [myiuse] -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for optional -# apache-2.4.x support. If the myiuse parameter is not given it defaults to -# apache2. -# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup() -# with the same myiuse parameter. -want_apache2_4() { - debug-print-function $FUNCNAME $* - - local myiuse=${1:-apache2} - IUSE="${IUSE} ${myiuse}" - DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_4_DEPEND} )" - RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_4_DEPEND} )" -} - -# @FUNCTION: need_apache -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for apache. -need_apache() { - debug-print-function $FUNCNAME $* - need_apache2 -} - -# @FUNCTION: need_apache2 -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for apache-2.x. -need_apache2() { - debug-print-function $FUNCNAME $* - - DEPEND="${DEPEND} ${APACHE2_DEPEND}" - RDEPEND="${RDEPEND} ${APACHE2_DEPEND}" - _init_apache2 -} - -# @FUNCTION: need_apache2_2 -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for apache-2.2.x. -need_apache2_2() { - debug-print-function $FUNCNAME $* - - DEPEND="${DEPEND} ${APACHE2_2_DEPEND}" - RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}" - _init_apache2 -} - -# @FUNCTION: need_apache2_4 -# @DESCRIPTION: -# An ebuild calls this to get the dependency information for apache-2.4.x. -need_apache2_4() { - debug-print-function $FUNCNAME $* - - DEPEND="${DEPEND} ${APACHE2_4_DEPEND}" - RDEPEND="${RDEPEND} ${APACHE2_4_DEPEND}" - _init_apache2 -} - -# @FUNCTION: has_apache -# @DESCRIPTION: -# An ebuild calls this to get runtime variables for an indirect apache -# dependency without USE-flag, in which case want_apache does not work. -# DO NOT call this function in global scope. -has_apache() { - debug-print-function $FUNCNAME $* - - if has_version '>=www-servers/apache-2'; then - _init_apache2 - else - _init_no_apache - fi -} - -# @FUNCTION: has_apache_threads -# @USAGE: [myflag] -# @DESCRIPTION: -# An ebuild calls this to make sure thread-safety is enabled if apache has been -# built with a threaded MPM. If the myflag parameter is not given it defaults to -# threads. -has_apache_threads() { - debug-print-function $FUNCNAME $* - - case ${EAPI:-0} in - 0|1) - die "depend.apache.eclass: has_apache_threads is not supported for EAPI=${EAPI:-0}" - ;; - esac - - if ! has_version 'www-servers/apache[threads]'; then - return - fi - - local myflag="${1:-threads}" - - if ! use ${myflag}; then - echo - eerror "You need to enable USE flag '${myflag}' to build a thread-safe version" - eerror "of ${CATEGORY}/${PN} for use with www-servers/apache" - die "Need missing USE flag '${myflag}'" - fi -} - -# @FUNCTION: has_apache_threads_in -# @USAGE: <myforeign> [myflag] -# @DESCRIPTION: -# An ebuild calls this to make sure thread-safety is enabled in a foreign -# package if apache has been built with a threaded MPM. If the myflag parameter -# is not given it defaults to threads. -has_apache_threads_in() { - debug-print-function $FUNCNAME $* - - case ${EAPI:-0} in - 0|1) - die "depend.apache.eclass: has_apache_threads_in is not supported for EAPI=${EAPI:-0}" - ;; - esac - - if ! has_version 'www-servers/apache[threads]'; then - return - fi - - local myforeign="$1" - local myflag="${2:-threads}" - - if ! has_version "${myforeign}[${myflag}]"; then - echo - eerror "You need to enable USE flag '${myflag}' in ${myforeign} to" - eerror "build a thread-safe version of ${CATEGORY}/${PN} for use" - eerror "with www-servers/apache" - die "Need missing USE flag '${myflag}' in ${myforeign}" - fi -} - -EXPORT_FUNCTIONS pkg_setup |