# $Id$ PNAME="dovecot" PVER="1.2.10" PBUILD="r4" PCATEGORIE="net-mail" STATE="unstable" #DESCRIPTION="Dovecot is an IMAP and POP3 server written with security primarily in mind." HOMEPAGE="http://dovecot.org/" SDEPEND=">= net-mail/mail-base-files-0.1 >= sys-libs/pam-1.1 >= sys-libs/libcap-2.17 >= dev-libs/openssl-0.9.8k >= net-nds/openldap-2.4 >= dev-db/mysql5-5.1 >= dev-db/sqlite-3.6 >= dev-db/db-4.8" SRCFILE="${PNAME}-${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # set to 'yes' to disable hardcorded ldap # this generates an extra ldap split-package too (very experimental!) NO_HARDCODED_LDAP=no # rc cvs revision RC_CVS_REV=1.2 SPLIT_PACKAGES="${PNAME} ${PNAME}-mysql ${PNAME}-sqlite" [[ ${NO_HARDCODED_LDAP} = yes ]] && SPLIT_PACKAGES+=" ${PNAME}-ldap" sminclude mtools cleanutils SRC_URI=( http://dovecot.org/releases/${PVER%.*}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/dovecot.rc-${RC_CVS_REV} mirror://${PNAME}/${PNAME}-${PVER}-magellan-defaults.patch mirror://${PNAME}/${PNAME}-${PVER}-magellan-defaults-maildir.patch mirror://${PNAME}/${PNAME}-${PVER}-magellan-defaults-pam.patch mirror://${PNAME}/${PNAME}-${PVER}-magellan-defaults-ipv4a6.patch mirror://${PNAME}/${PNAME}-${PVER}-config-install.patch ) UP2DATE="updatecmd ${HOMEPAGE}/download.html | grep -A3 'Stable' | grep 'Download' | sed 's:.*v\(.*\)\ sources.*:\1:'" split_info_dovecot() { DESCRIPTION="Dovecot is an IMAP and POP3 server written with security primarily in mind." DEPEND=">= net-mail/mail-base-files-0.1 >= sys-libs/pam-1.1 >= sys-libs/libcap-2.17 >= dev-libs/openssl-0.9.8k >= dev-db/db-4.8" if [[ ${NO_HARDCODED_LDAP} != yes ]] then DEPEND="${DEPEND} >= net-nds/openldap-2.4" fi preinstall() { # adding proftpd user ${MLIBDIR}/mgroupadd -o "-g 97" dovecot ${MLIBDIR}/museradd -o "-u 97 -g dovecot -d /dev/null -s /bin/false" dovecot } postinstall() { # generate a self-signed ssl-cert if [[ ! -f /etc/ssl/certs/dovecot.pem ]] then echo echo "You need to generate a certificate to run this daemon." echo "Just run: 'openssl-make-certs dovecot'." echo fi mstartservice dovecot } postremove() { mstopservice dovecot } } split_info_dovecot-mysql() { DESCRIPTION="Plugin to add MySQL support to the Dovecot Mail server." DEPEND="== net-mail/dovecot-${PVER} >= dev-db/mysql5-5.1" } split_info_dovecot-sqlite() { DESCRIPTION="Plugin to add SQLite support to the Dovecot Mail server." DEPEND="== net-mail/dovecot-${PVER} >= dev-db/sqlite-3.6" } if [[ ${NO_HARDCODED_LDAP} = yes ]] then split_info_dovecot-ldap() { DESCRIPTION="Plugin to add LDAP support to the Dovecot Mail server." DEPEND="== net-mail/dovecot-${PVER} >= net-nds/openldap-2.4" } fi src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # apply our default settings mpatch ${PNAME}-${PVER}-magellan-defaults.patch || die # enable maildir as default mpatch ${PNAME}-${PVER}-magellan-defaults-maildir.patch || die # we're using pam files (imap and pop3) provided by mailbase mpatch ${PNAME}-${PVER}-magellan-defaults-pam.patch || die # use ipv4 and ipv6 support mpatch ${PNAME}-${PVER}-magellan-defaults-ipv4a6.patch || die # install only devcot.conf and not any examples to /etc/dovecot mpatch ${PNAME}-${PVER}-config-install.patch || die } src_compile() { cd ${SRCDIR} mconfigure \ --sysconfdir=/etc/dovecot \ --libexecdir=/usr/$(mlibdir)/dovecot \ --with-moduledir=/usr/$(mlibdir)/dovecot \ --localstatedir=/var \ --enable-header-install \ --enable-ipv6 \ --disable-debug \ --disable-static \ --with-ioloop=best \ --with-poll=best \ --with-libcap \ --with-ssl=openssl \ --with-ssldir=/etc/ssl \ --with-ldap=plugin \ --with-sql=plugin \ --with-sql-drivers \ --with-mysql \ --with-sqlite \ --with-db \ --with-pam \ || die # build dovecot normally mmake || die if [[ ${NO_HARDCODED_LDAP} = yes ]] then # save all ldap plugins linked against -lldap cp src/auth/.libs/libauthdb_ldap.so libauthdb_ldap.so.no-ldap || die # then rebuild dovecot without hardcoded ldap make clean || die mmake LIBS='-lrt' LDAP_LIBS='' || die fi } src_install_dovecot() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # install our initscript minstallrc dovecot.rc-${RC_CVS_REV} dovecot || die # remove unwanted docs rm -rf ${BINDIR}/usr/share/doc/dovecot || die # needed directories mkeepdir /var/run/dovecot/login || die mchown root:dovecot /var/run/dovecot/login || die mchmod 0700 /var/run/dovecot/login || die minstalldocs AUTHORS ChangeLog COPYING* NEWS README TODO || die minstalldocs dovecot-example.conf || die minstalldocs doc/dovecot-db-example.conf || die minstalldocs doc/dovecot-sql-example.conf || die minstalldocs doc/dovecot-ldap-example.conf || die } src_install_dovecot-mysql() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # first keep the whole modulesdir zapmost ${BINDIR} usr/$(mlibdir)/dovecot || die # now seperate all modules zapmost ${BINDIR}/usr/$(mlibdir)/dovecot auth/libdriver_mysql.* dict/libdriver_mysql.* sql/libdriver_mysql.* || die } src_install_dovecot-sqlite() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # first keep the whole modulesdir zapmost ${BINDIR} usr/$(mlibdir)/dovecot || die # now seperate all modules zapmost ${BINDIR}/usr/$(mlibdir)/dovecot auth/libdriver_sqlite.* dict/libdriver_sqlite.* sql/libdriver_sqlite.* || die } if [[ ${NO_HARDCODED_LDAP} = yes ]] then src_install_dovecot-ldap() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # first keep the whole modulesdir zapmost ${BINDIR} usr/$(mlibdir)/dovecot || die # now seperate all modules zapmost ${BINDIR}/usr/$(mlibdir)/dovecot auth/libauthdb_ldap.* || die # install saved ldap plugins linked against -lldap minstallexec libauthdb_ldap.so.no-ldap /usr/$(mlibdir)/dovecot/auth/libauthdb_ldap.so || die } fi