# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils multilib flag-o-matic autotools MY_P="${P/_rc/.rc}" MY_PV="${PV/_rc/.rc}" MY_P="${P/_alpha/.a}" MY_PV="${PV/_alpha/.a}" DESCRIPTION="389 Directory Server (base)" HOMEPAGE="http://port389.org/" SRC_URI="http://port389.org/sources/${MY_P}.tar.bz2 http://ftp.mars.arge.at/389-ds/1.2.x/${MY_P}.tar.bz2" LICENSE="GPL-2-with-exceptions" SLOT="0" KEYWORDS="~amd64 ~x86 ~arm" IUSE="+autobind +auto-dn-suffix +nss +nspr +icu +sasl +snmp +svrcore +berkdb +mozldap openldap debug doc +pam +dna +ldapi +bitwise presence kerberos selinux" ALL_DEPEND="nss? ( dev-libs/nss[utils] ) nspr? ( dev-libs/nspr ) svrcore? ( dev-libs/svrcore ) mozldap? ( dev-libs/mozldap ) openldap? ( net-nds/openldap ) sasl? ( >=dev-libs/cyrus-sasl-2.1.19 ) icu? ( >=dev-libs/icu-3.4 ) berkdb? ( >=sys-libs/db-4.5 ) snmp? ( >=net-analyzer/net-snmp-5.1.2 ) dev-libs/openssl sys-apps/tcp-wrappers pam? ( sys-libs/pam ) sys-libs/zlib dev-perl/perl-mozldap dev-libs/libpcre kerberos? ( >=app-crypt/mit-krb5-1.7-r100[ldap] ) selinux? ( >=sys-apps/policycoreutils-1.30.30 sec-policy/selinux-base-policy )" DEPEND="${ALL_DEPEND} dev-util/pkgconfig sys-devel/libtool:1.5 doc? ( app-doc/doxygen ) selinux? ( sys-devel/m4 >=sys-apps/checkpolicy-1.30.12 )" RDEPEND="${ALL_DEPEND} virtual/perl-Time-Local virtual/perl-MIME-Base64" S="${WORKDIR}/${PN}-${MY_PV}" pkg_setup() { enewgroup dirsrv enewuser dirsrv -1 -1 -1 dirsrv } src_prepare() { sed -e "s!nobody!dirsrv!g" -i configure.ac epatch "${FILESDIR}/0001-Bug-480787-Autoconf-parameter-with-and-without.patch" epatch "${FILESDIR}/389-ds-base-1.2.6.a2-gentoo_selinux-1.patch" eautoreconf } src_configure() { econf $(use_enable debug) \ $(use_enable pam pam-passthru) \ $(use_enable dna) \ $(use_enable bitwise) \ $(use_enable presence) \ $(use_enable auto-dn-suffix) \ $(use_enable ldapi) \ $(use_enable autobind) \ $(use_with kerberos) \ $(use_with selinux) \ $(use_with berkdb db) \ $(use_with mozldap ldapsdk) \ $(use_with openldap) \ $(use_with sasl) \ $(use_with svrcore) \ $(use_with snmp netsnmp) \ $(use_with icu) \ $(use_with nss) \ $(use_with nspr) \ --with-fhs || die "econf failed" # $(use_with sasl sasl yes) \ # $(use_with snmp netsnmp yes) \ } src_compile() { append-lfs-flags emake || die "compile failed" if use selinux; then emake -f selinux/Makefile || die " build selinux policy failed" fi use doc && doxygen slapi.doxy } src_install() { emake DESTDIR="${D}" install || die "emake failed" if use selinux;then emake -f selinux/Makefile DESTDIR="${D}" install || die "Install selinux policy failed" fi # install not installed header insinto /usr/include/dirsrv doins ldap/servers/slapd/slapi-plugin.h doins ldap/servers/plugins/replication/winsync-plugin.h # make sure perl scripts have a proper shebang for i in "${D}"/usr/share/dirsrv/script-templates/template-*.pl ;do dosed 's/#{{PERL-EXEC}}/#\!\/usr\/bin\/perl/' /usr/share/dirsrv/script-templates/${i##*/} || die done # remove redhat style init script and install gentoo style rm -rf "${D}"/etc/rc.d rm -rf "${D}"/etc/default newinitd "${FILESDIR}"/dirsrv.initd dirsrv newconfd "${FILESDIR}"/dirsrv.confd dirsrv newinitd "${FILESDIR}"/dirsrv-snmp.initd dirsrv-snmp # cope with libraries being in /usr/lib/dirsrv dodir /etc/env.d echo "LDPATH=/usr/$(get_libdir)/dirsrv" > "${D}"/etc/env.d/08dirsrv # create log and database directories keepdir /var/lock/dirsrv keepdir /var/lib/dirsrv use doc && dohtml -r docs/html } pkg_postinst() { chown dirsrv:dirsrv "${ROOT}"/var/lock/dirsrv chown dirsrv:dirsrv "${ROOT}"/var/lib/dirsrv if use selinux;then if has "loadpolicy" $FEATURES ; then einfo "Inserting the following modules into the module store" cd /usr/share/selinux/targeted # struct policy not supported semodule -s dirsrv -i dirsrv.pp else echo echo eerror "Policy has not been loaded. It is strongly suggested" eerror "that the policy be loaded before continuing!!" echo einfo "Automatic policy loading can be enabled by adding" einfo "\"loadpolicy\" to the FEATURES in make.conf." echo echo ebeep 4 epause 4 fi fi }