--- /usr/portage/eclass/apache-2.eclass 2016-03-03 12:59:02.334533099 -0500 +++ ../../eclass/apache-2.eclass 2016-10-11 14:50:00.265004727 -0400 @@ -94,6 +94,13 @@ # This variable needs to be set in the ebuild and contains a list of available # built-in modules +# @ECLASS-VARIABLE: APACHE2_HAS_SHARED_MPMS +# @DESCRIPTION: +# When this variable is set to any value in an ebuild, the build supports +# several, shared MPMs chosen at runtime +# Requires Apache 2.4 or greater + + IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" IUSE="${IUSE} debug doc ldap libressl selinux ssl static suexec threads" @@ -131,23 +138,33 @@ # @DESCRIPTION: # This internal variable contains the selected MPM after a call to setup_mpm() +# @ECLASS-VARIABLE: MY_SHARED_MPMS +# @DESCRIPTION: +# This internal variable contains the selected shared MPMs when the build +# supports shared MPMs and not static + # @FUNCTION: setup_mpm # @DESCRIPTION: # This internal function makes sure that only one of APACHE2_MPMS was selected # or a default based on USE=threads is selected if APACHE2_MPMS is empty setup_mpm() { MY_MPM="" + MY_SHARED_MPMS="" for x in ${IUSE_MPMS} ; do if use apache2_mpms_${x} ; then - if [[ -z "${MY_MPM}" ]] ; then - MY_MPM=${x} - elog - elog "Selected MPM: ${MY_MPM}" - elog + if [[ -n "${APACHE2_HAS_SHARED_MPMS}" ]] && ! use static ; then + MY_SHARED_MPMS+="${x} " else - eerror "You have selected more then one mpm USE-flag." - eerror "Only one MPM is supported." - die "more then one mpm was specified" + if [[ -z "${MY_MPM}" ]] ; then + MY_MPM=${x} + elog + elog "Selected MPM: ${MY_MPM}" + elog + else + eerror "You have selected more then one mpm USE-flag." + eerror "Only one MPM is supported." + die "more then one mpm was specified" + fi fi fi done @@ -358,6 +375,20 @@ fi done + if [[ -n "${MY_SHARED_MPMS}" ]] ; then + mod_lines="${mod_lines}\n\n# Available MPM modules; Only one can be active at a time" + fi + + for m in ${MY_SHARED_MPMS} ; do + if [[ -e "${mod_dir}/mod_mpm_${m}.so" ]] ; then + if [[ "${m}x" = "${MY_MPM}x" ]] ; then + mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_mpm_${m}.so" + else + mod_lines="${mod_lines}\n#LoadModule ${m}_module modules/mod_mpm_${m}.so" + fi + fi + done + sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \ "${GENTOO_PATCHDIR}"/conf/httpd.conf } @@ -501,6 +532,10 @@ use debug && append-flags -DMPM_PERUSER_DEBUG fi + if [[ -n "${MY_SHARED_MPMS}" ]] ; then + MY_CONF+=( --enable-mpms-shared="${MY_SHARED_MPMS}" ) + fi + # econf overwrites the stuff from config.layout, so we have to put them into # our myconf line too ac_cv_path_PKGCONFIG=${PKG_CONFIG} \