# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-mail/dovecot/dovecot-1.1_rc8.ebuild,v 1.1 2008/06/04 08:16:55 wschlich Exp $ EAPI="2" inherit eutils versionator major_minor="$( get_version_component_range 1-2 "${PV}" )" sieve_version="0.1.9" managesieve_version="0.11.7" SRC_URI="http://dovecot.org/releases/${major_minor}/${P}.tar.gz sieve? ( http://www.rename-it.nl/dovecot/${major_minor}/dovecot-${major_minor}-sieve-${sieve_version}.tar.gz ) managesieve? ( http://www.rename-it.nl/dovecot/${major_minor}/dovecot-${PV}-managesieve-${managesieve_version}.diff.gz http://www.rename-it.nl/dovecot/${major_minor}/dovecot-${major_minor}-managesieve-${managesieve_version}.tar.gz )" DESCRIPTION="An IMAP and POP3 server written with security primarily in mind" HOMEPAGE="http://www.dovecot.org/" SLOT="0" LICENSE="LGPL-2.1" # MIT too? KEYWORDS="~amd64 ~x86" IUSE="bzip2 checkpassword caps cydir berkdb dbox doc gnutls kerberos kerberos_plugin ldap ldap_plugin lucene maildir managesieve mbox mysql nsswitch pam passwd passwd_file postgres prefetch_userdb sieve shadow sql_plugins sqlite3 ssl static_userdb suid vpopmail zlib" DEPEND="caps? ( sys-libs/libcap ) berkdb? ( sys-libs/db ) gnutls? ( net-libs/gnutls ) kerberos? ( virtual/krb5 ) kerberos_plugin? ( virtual/krb5 ) ldap? ( net-nds/openldap ) ldap_plugin? ( net-nds/openldap ) lucene? ( dev-java/lucene ) mysql? ( virtual/mysql ) pam? ( virtual/pam ) postgres? ( virtual/postgres-base ) sqlite3? ( dev-db/sqlite ) ssl? ( dev-libs/openssl ) vpopmail? ( net-mail/vpopmail )" RDEPEND="${DEPEND}" pkg_setup() { if ! use sieve && use managesieve; then eerror "managesieve USE flag selected but sieve USE flag unselected" die "USE flag problem" fi # Add user and group for login process (same as for fedora/redhat) enewgroup dovecot 97 enewuser dovecot 97 -1 /dev/null dovecot } src_unpack() { unpack ${A} cd "${S}" use managesieve && epatch "${WORKDIR}"/dovecot-${PV}-managesieve-${managesieve_version}.diff } src_configure() { local conf="" if use sql_plugins; then conf="${conf} --with-sql=plugin" elif use postgres || use mysql || use sqlite3; then conf="${conf} --with-sql=yes" fi if use ldap_plugin; then conf="${conf} --with-ldap=plugin" elif use ldap; then conf="${conf} --with-ldap=yes" fi if use gnutls; then conf="${conf} --with-ssl=gnutls" elif use ssl; then conf="${conf} --with-ssl=openssl" else conf="${conf} --without-ssl" fi if use kerberos_plugin; then conf="${conf} --with-gssapi=plugin" elif use kerberos; then conf="${conf} --with-gssapi=yes" fi local storages="" use maildir && storages="maildir" use mbox && storages="${storages} mbox" use dbox && storages="${storages} dbox" use cydir && storages="${storages} cydir" [ "${storages}" ] || storages="maildir" econf \ --sysconfdir=/etc/dovecot \ --localstatedir=/var \ --with-moduledir="/usr/$( get_libdir )/dovecot" \ $( use_with nsswitch nss ) \ $( use_with shadow ) \ $( use_with passwd ) \ $( use_with pam ) \ $( use_with checkpassword ) \ $( use_with vpopmail ) \ $( use_with berkdb db ) \ $( use_with postgres pgsql ) \ $( use_with mysql ) \ $( use_with sqlite3 sqlite ) \ $( use_with static_userdb static-userdb ) \ $( use_with prefetch_userdb prefetch-userdb ) \ $( use_with passwd_file passwd-file ) \ $( use_with caps libcap ) \ $( use_with lucene ) \ $( use_with zlib ) \ $( use_with bzip2 bzlib ) \ --with-storages="${storages}" \ --with-pic \ --enable-header-install \ ${conf} \ || die "configure failed" if use sieve; then # The sieve plugin needs this file to be build to determine the plugin # directory and the list of libraries to link to. emake dovecot-config || die "emake dovecot-config failed" cd "../dovecot-${major_minor}-sieve-${sieve_version}" econf --with-dovecot="${S}" if use managesieve; then cd "../dovecot-${major_minor}-managesieve-${managesieve_version}" econf --with-dovecot="${S}" --with-dovecot-sieve="../dovecot-${major_minor}-sieve-${sieve_version}" fi fi } src_compile() { emake || die "make failed" if use sieve; then cd "../dovecot-${major_minor}-sieve-${sieve_version}" emake || die "make failed" if use managesieve; then cd "../dovecot-${major_minor}-managesieve-${managesieve_version}" emake || die "make failed" fi fi } src_install () { make DESTDIR="${D}" install || die "make install failed" use suid && fperms u+s /usr/libexec/dovecot/deliver rm -f "${D}"/etc/dovecot/*.conf newinitd "${FILESDIR}"/dovecot.init-r1 dovecot rm -rf "${D}"/usr/share/doc/dovecot use doc && dodoc AUTHORS NEWS README TODO dovecot-example.conf doc/dovecot-{db,dict-sql,ldap,sql}-example.conf doc/{securecoding,auth-protocol,documentation}.txt doc/dovecot-openssl.cnf if use sieve; then cd "../dovecot-${major_minor}-sieve-${sieve_version}" emake DESTDIR="${D}" install || die "make install failed" if use managesieve; then cd "../dovecot-${major_minor}-managesieve-${managesieve_version}" emake DESTDIR="${D}" install || die "make install failed" fi fi dodir /var/run/dovecot fowners root:root /var/run/dovecot fperms 0755 /var/run/dovecot keepdir /var/run/dovecot/login fowners root:dovecot /var/run/dovecot/login fperms 0750 /var/run/dovecot/login }