# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # supposedly this module also supports apache1, depends on apache2 until tested. detectapache() { local domsg= [ -n "$1" ] && domsg=1 HAVE_APACHE1= HAVE_APACHE2= has_version '=net-www/apache-1*' && HAVE_APACHE1=1 has_version '=net-www/apache-2*' && HAVE_APACHE2=1 [ -n "${HAVE_APACHE1}" ] && APACHEVER=1 [ -n "${HAVE_APACHE2}" ] && APACHEVER=2 [ -n "${HAVE_APACHE1}" ] && [ -n "${HAVE_APACHE2}" ] && APACHEVER='both' case "${APACHEVER}" in 1) [ -n "${domsg}" ] && einfo 'Apache1 only detected' ;; 2) [ -n "${domsg}" ] && einfo 'Apache2 only detected' apache=2 ;; both) if [ "`use apache2`" ]; then [ -n "${domsg}" ] && einfo "Multiple Apache versions detected, using Apache2 (USE=apache2)" APACHEVER=2 apache=2 else [ -n "${domsg}" ] && einfo 'Multiple Apache versions detected, using Apache1 (USE=-apache2)' APACHEVER=1 fi ;; *) if [ -n "${domsg}" ]; then MSG="Unknown Apache version!"; eerror $MSG ; die $MSG else APACHEVER=0 fi; ;; esac } detectapache SLOT="${APACHEVER}" [ "${APACHEVER}" -eq '2' ] && USE_APACHE2='2' || USE_APACHE2='' IUSE="apache2" DESCRIPTION="mod_ldap_userdir is a module that enables the Apache web server to look up user home directories (for /~user URLs) from an LDAP directory." HOMEPAGE="http://horde.net/~jwm/software/mod_ldap_userdir/" KEYWORDS="x86" S=${WORKDIR}/${P} SRC_URI="http://horde.net/~jwm/software/mod_ldap_userdir/mod_ldap_userdir-1.1.4.tar.bz2" DEPEND="=net-www/apache-2* net-nds/openldap" LICENSE="GPL" SLOT="0" src_compile() { local myconf use apache2 && myconf="${myconf} --with-apxs=/usr/sbin/apxs2" myconf="${myconf} --with-activate" ./configure ${myconf} || die make clean make || die } src_install() { detectapache dodoc DIRECTIVES README user-ldif posixAccount-objectclass exeinto /usr/lib/apache${apache}-extramodules doexe mod_ldap_userdir.so insinto /etc/apache${apache}/conf/modules.d doins ${FILESDIR}/47_mod_ldap_userdir.conf } pkg_postinst() { detectapache if [ -n "${USE_APACHE2}" ] ; then einfo "Adjust /etc/apache2/conf/modules.d/47_mod_ldap_userdir.conf to match your setup and" einfo "add '-D LDAPuserdir' to your APACHE2_OPTS in /etc/conf.d/apache2" fi }