diff options
author | 2004-11-21 01:51:58 +0000 | |
---|---|---|
committer | 2004-11-21 01:51:58 +0000 | |
commit | b5e0dcc81ba3e085c17e95ca65b6f3b3daaeea28 (patch) | |
tree | 85b841aa14a7b93e5d71641dfb7088971723bcc3 /eclass | |
parent | dep fix (Manifest recommit) (diff) | |
download | gentoo-2-b5e0dcc81ba3e085c17e95ca65b6f3b3daaeea28.tar.gz gentoo-2-b5e0dcc81ba3e085c17e95ca65b6f3b3daaeea28.tar.bz2 gentoo-2-b5e0dcc81ba3e085c17e95ca65b6f3b3daaeea28.zip |
Adding apache-module.eclass and new version of depend.apache.eclass
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/apache-module.eclass | 378 | ||||
-rw-r--r-- | eclass/depend.apache.eclass | 201 | ||||
-rw-r--r-- | eclass/games.eclass | 12 |
3 files changed, 505 insertions, 86 deletions
diff --git a/eclass/apache-module.eclass b/eclass/apache-module.eclass new file mode 100644 index 000000000000..c55d4c735bae --- /dev/null +++ b/eclass/apache-module.eclass @@ -0,0 +1,378 @@ +# Copyright 2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Michael Tindal <urilith@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.1 2004/11/21 01:51:58 urilith Exp $ +ECLASS=apache-module +INHERITED="$INHERITED $ECLASS" + +inherit depend.apache + +# This eclass provides a common set of functions for Apache modules. + +###### +## Common ebuild variables +###### + +#### +## APXS1_S, APXS2_S +## +## Paths to temporary build directories +#### +APXS1_S="" +APXS2_S="" + +#### +## APXS1_ARGS, APXS2_ARGS +## +## Arguments to pass to the apxs tool +#### +APXS1_ARGS="" +APXS2_ARGS="" + +#### +## APACHE1_MOD_FILE, APACHE2_MOD_FILE +## +## Name of the module that src_install installs (only, minus the .so) +#### +APACHE1_MOD_FILE="" +APACHE2_MOD_FILE="" + +#### +## APACHE1_MOD_CONF, APACHE2_MOD_CONF +## +## Configuration file installed by src_install +#### +APACHE1_MOD_CONF="" +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 +#### +APACHE1_MOD_DEFINE="" +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 +#### +DOCFILES="" + +###### +## Utility functions +###### + +#### +## apache_cd_dir +## +## Return the path to our temporary build dir +#### +apache_cd_dir() { + debug-print-function apache_cd_dir + + if [ "${APACHE_VERSION}" == "1" ]; then + [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}" + else + [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}" + fi + + # 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" + else + CD_DIR="${S}" + fi + fi + + debug-print apache_cd_dir: "CD_DIR=${CD_DIR}" + echo ${CD_DIR} +} + +#### +## apache_mod_file +## +## Return the path to the module file +#### +apache_mod_file() { + debug-print-function apache_mod_file + + 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 + + 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. +#### +apache_doc_magic() { + debug-print-function apache_doc_magic $* + + 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 + + debug-print apache_doc_magic: DOCS=${DOCS} + echo ${DOCS} + fi +} + +###### +## Apache 1.x ebuild functions +###### + +#### +## apache1_src_compile +## The default action is to call ${APXS11} with the value of +## ${APXS1_ARGS}. If a module requires a different build setup +## than this, use ${APXS1} in your own src_compile routine. +#### +apache1_src_compile () { + debug-print-function apache1_src_compile + + 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 +## +## 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 APACHE1_MOD_CONF without the .conf extensions, +## so if you configuration is 55_mod_foo.conf, APACHE1_MOD_CONF would be 55_mod_foo. +## DOCFILES contains the list of files you want filed as documentation. The name of the +## module can also be specified using the APACHE1_MOD_FILE or defaults to +## .libs/${PN}.so. +#### +apache1_src_install() { + debug-print-function apache1_src_install + + 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: \'${APACHE2_MOD_CONF}.conf\' not found." + + einfo + einfo "Configuration file installed as ${APACHE1_MODULES_CONFDIR}/${APACHE1_MOD_CONF}.conf" + einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" + einfo + 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 +## +## Prints the standard config message, unless APACHE1_NO_CONFIG is set to yes. +#### +apache1_pkg_postinst() { + debug-print-function apache1_pkg_postinst + + if [ -n "${APACHE1_MOD_DEFINE}" ]; then + einfo + einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache file and" + einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." + 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 () { + debug-print-function apache2_pkg_setup + + if [ -n "${APACHE2_MT_UNSAFEE}" ]; then + if [ "x${APACHE2_MT_UNSAFE}" != "no" ]; then + APACHE2_MPM_STYLE=`/usr/sbin/apxs2 -q MPM_NAME` + if [ "x$APACHE2_MPM_STYLE" != "xprefork" ]; then + eerror "You currently have Apache configured to use the." + eerror "$APACHE2_MPM_STYLE MPM style. The module you are" + eerror "trying to install is not currently thread-safe," + eerror "and will not work under your current configuraiton." + echo + eerror "If you still want to use the module, please reinstall" + eerror "Apache with mpm-prefork set." + + epause + ebeep + die Invalid Apache MPM style. + fi + fi + 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 () { + debug-print-function apache2_src_compile + + CD_DIR=$(apache_cd_dir) + cd ${CD_DIR} || die "cd ${CD_DIR} failed" + APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" + ${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() { + debug-print-function apache2_src_install + + CD_DIR=$(apache_cd_dir) + cd ${CD_DIR} || die "cd ${CD_DIR} failed" + + MOD_FILE=$(apache_mod_file) + + exeinto ${APACHE2_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 ${APACHE2_MODULES_CONFDIR} + doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: \'${APACHE2_MOD_CONF}.conf\' not found." + + einfo + einfo "Configuration file installed as ${APACHE2_MODULES_CONFDIR}/${APACHE2_MOD_CONF}.conf" + einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" + einfo + fi + + if [ -n "${APACHE2_VHOSTFILE}" ]; then + insinto ${APACHE2_MODULES_VHOSTDIR} + doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf + 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 +} + +apache2_pkg_postinst() { + debug-print-function apache2_pkg_postinst + + if [ -n "${APACHE2_MOD_DEFINE}" ]; then + einfo + einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and" + einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." + einfo + fi +} + +###### +## Apache dual (1.x or 2.x) ebuild functions +## +## 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 apache-module_pkg_setup + + if [ ${APACHE_VERSION} -eq '2' ]; then + apache2_pkg_setup + fi +} + +apache-module_src_compile() { + debug-print-function apache-module_src_compile + + if [ ${APACHE_VERSION} -eq '1' ]; then + apache1_src_compile + else + apache2_src_compile + fi +} + +apache-module_src_install() { + debug-print-function apache-module_src_install + + if [ ${APACHE_VERSION} -eq '1' ]; then + apache1_src_install + else + apache2_src_install + fi +} + +apache-module_pkg_postinst() { + debug-print-function apache-module_pkg_postinst + + if [ ${APACHE_VERSION} -eq '1' ]; then + apache1_pkg_postinst + else + apache2_pkg_postinst + fi +} + +EXPORT_FUNCTIONS pkg_setup src_compile src_install pkg_postinst + +# vim:ts=4 diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass index 869a760b34ea..75152969ad7d 100644 --- a/eclass/depend.apache.eclass +++ b/eclass/depend.apache.eclass @@ -1,90 +1,131 @@ -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.5 2004/07/24 08:50:23 robbat2 Exp $ - -ECLASS="depend.apache" +# Copyright 2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Michael Tindal <urilith@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.6 2004/11/21 01:51:58 urilith Exp $ +ECLASS=depend.apache INHERITED="$INHERITED $ECLASS" -IUSE="apache apache2" - -# remember to set MY_SLOT if you want to include something like ${PVR} in -# the slot information -# SLOT="apache? ( 1{$MY_SLOT} ) apache2? ( 2{$MY_SLOT} ) !apache1? ( !apache2? ( 2${MY_SLOT} ) )" - -DEPEND="$DEPEND apache? ( =net-www/apache-1* ) apache2? ( =net-www/apache-2* ) - !apache? ( !apache2? ( =net-www/apache-2* ) )" - -# call this function to work out which version of the apache web server -# your ebuild should be installing itself to use -detect_apache_useflags() { - USE_APACHE1= - USE_APACHE2= - USE_APACHE_MULTIPLE= - - useq apache2 && USE_APACHE2=1 - useq apache && USE_APACHE1=1 - - [ -n "$USE_APACHE1" ] && [ -n "$USE_APACHE2" ] && USE_APACHE_MULTIPLE=1 +###### +## 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. +#### +APACHE_VERSION='2' + +#### +## APXS1, APXS2 +## +## Paths to the apxs tools +#### +APXS1="/usr/sbin/apxs" +APXS2="/usr/sbin/apxs2" + +#### +## APACHECTL1, APACHECTL2 +## +## Paths to the apachectl tools +#### +APACHECTL1="/usr/sbin/apachectl" +APACHECTL2="/usr/sbin/apache2ctl" + +#### +## APACHE1_BASEDIR, APACHE2_BASEDIR +## +## Paths to the server root directories +#### +APACHE1_BASEDIR="/usr/lib/apache" +APACHE2_BASEDIR="/usr/lib/apache2" + +#### +## APACHE1_CONFDIR, APACHE2_CONFDIR +## +## Paths to the configuration file directories (usually under +## $APACHE?_BASEDIR/conf) +#### +APACHE1_CONFDIR="/etc/apache" +APACHE2_CONFDIR="/etc/apache2" + +#### +## APACHE1_MODULES_CONFDIR, APACHE2_MODULES_CONFDIR +## +## Paths where module configuration files are kept +#### +APACHE1_MODULES_CONFDIR="${APACHE1_CONFDIR}/modules.d" +APACHE2_MODULES_CONFDIR="${APACHE2_CONFDIR}/modules.d" + +#### +## APACHE1_MODULES_VHOSTDIR, APACHE2_MODULES_VHOSTDIR +## +## Paths where virtual host configuration files are kept +#### +APACHE1_VHOSTDIR="${APACHE1_CONFDIR}/vhosts.d" +APACHE2_VHOSTDIR="${APACHE2_CONFDIR}/vhosts.d" + +#### +## APACHE1_MODULESDIR, APACHE2_MODULESDIR +## +## Paths where we install modules +#### +APACHE1_MODULESDIR="${APACHE1_BASEDIR}/modules" +APACHE2_MODULESDIR="${APACHE2_BASEDIR}/modules" + +#### +## APACHE1_DEPEND, APACHE2_DEPEND +## +## Dependencies for apache 1.x and apache 2.x +#### +APACHE1_DEPEND="=net-www/apache-1*" +APACHE2_DEPEND="=net-www/apache-2*" + +#### +## need_apache1 +## +## An ebuild calls this to get the dependency information +## for apache-1.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_apache1 somewhere. +#### +need_apache1() { + debug-print-function need_apache1 + + DEPEND="${DEPEND} ${APACHE1_DEPEND}" + APACHE_VERSION='1' } -detect_apache_installed() { - HAS_APACHE1= - HAS_APACHE2= - HAS_APACHE_MULTIPLE= - HAS_APACHE_ANY= - - has_version '=net-www/apache-1*' && HAS_APACHE1=1 && HAS_APACHE_ANY=1 - has_version '=net-www/apache-2*' && HAS_APACHE2=1 && HAS_APACHE_ANY=1 - - [ -n "${HAVE_APACHE1}" ] && [ -n "${HAVE_APACHE2}" ] && HAVE_APACHE_MULTIPLE=1 +#### +## 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_apache1 somewhere. +#### +need_apache2() { + debug-print-function need_apache2 + + DEPEND="${DEPEND} ${APACHE2_DEPEND}" + APACHE_VERSION='2' } -# call this function from your pkg_setup - -depend_apache() { - detect_apache_installed - detect_apache_useflags - - # deal with the multiple cases first - much easier - if [ -n "$USE_APACHE_MULTIPLE" ]; then - echo - eerror "You have both the apache and apache2 USE flags set" - eerror - eerror "Please set only ONE of these USE flags, and try again" - echo - die "Multiple Apache USE flags set - you can only have one set at a time" - fi +need_apache() { + debug-print-function need_apache - if [ -n "$USE_APACHE2" ] ; then - if [ -z "$HAS_APACHE2" -a -n "$HAS_APACHE_ANY" ] ; then - echo - eerror "You have the 'apache2' USE flag set, but only have Apache v1 installed" - eerror "If you really meant to upgrade to Apache v2, please install Apache v2" - eerror "before installing $CATEGORY/${PN}-${PVR}" - echo - die "Automatic upgrade of Apache would be forced; avoiding" - else - einfo "Apache 2 support enabled" - DETECT_APACHE=2 - return - fi + IUSE="${IUSE} apache2" + if useq apache2; then + need_apache2 + else + need_apache1 fi - - if [ -n "$USE_APACHE1" ]; then - if [ -z "$HAS_APACHE1" -a -n "$HAS_APACHE_ANY" ]; then - echo - eerror "You have the 'apache' USE flag set, but only have a later version of" - eerror "Apache installed on your computer. Please use the 'apache2' USE flag" - eerror "or downgrade to Apache v1 before installing $CATEGORY/${PN}-${PVR}" - echo - die "Avoiding installing older version of Apache" - else - einfo "Apache 1 support enabled" - DETECT_APACHE=1 - return - fi - fi - - [ -z "$DETECT_APACHE" ] && DETECT_APACHE=2 } diff --git a/eclass/games.eclass b/eclass/games.eclass index 40140fb77455..eee039ccc9ba 100644 --- a/eclass/games.eclass +++ b/eclass/games.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/games.eclass,v 1.80 2004/10/13 06:28:20 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/games.eclass,v 1.81 2004/11/21 01:51:58 urilith Exp $ # # devlist: {vapier,wolf31o2,mr_bones_}@gentoo.org # @@ -126,11 +126,11 @@ EOF } games_pkg_setup() { - enewgroup "${GAMES_GROUP}" 35 - [ "${GAMES_USER}" != "root" ] \ - && enewuser "${GAMES_USER}" 35 /bin/false /usr/games "${GAMES_GROUP}" - [ "${GAMES_USER_DED}" != "root" ] \ - && enewuser "${GAMES_USER_DED}" 36 /bin/bash /usr/games "${GAMES_GROUP}" + #enewgroup "${GAMES_GROUP}" 35 + #[ "${GAMES_USER}" != "root" ] \ + #&& enewuser "${GAMES_USER}" 35 /bin/false /usr/games "${GAMES_GROUP}" + #[ "${GAMES_USER_DED}" != "root" ] \ + #&& enewuser "${GAMES_USER_DED}" 36 /bin/bash /usr/games "${GAMES_GROUP}" # Dear carpaski and portage-dev team, we are so sorry. Lots of love, games team # See Bug #61680 |