From e9aa0506897f7bbfca676c063e2c8686f1a0801b Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Tue, 19 Feb 2013 23:34:02 +0100 Subject: [PATCH] dovecot: improved package config preparing for a more generic auto-configuration --- mail/dovecot/dovecot.conf | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/mail/dovecot/dovecot.conf b/mail/dovecot/dovecot.conf index d6340214b..bc6fa8bb3 100644 --- a/mail/dovecot/dovecot.conf +++ b/mail/dovecot/dovecot.conf @@ -15,16 +15,27 @@ # install development headers by default var_append confopt ' ' "--enable-header-install" -# LDAP support -if pkginstalled openldap ; then - pkgprefix -t openldap - var_append extraconfopt ' ' "--with-ldap" -fi +# package/option mappings for auto-configuration +pkg_dovecot_options="openldap:ldap postgresql:pgsql" -# generic SQL support -var_append extraconfopt ' ' "--with-sql=plugin" - -# postgresql support -if pkginstalled -f postgresql; then - var_append extraconfopt ' ' "--with-pgsql" -fi +# automatic feature selection according to the package/option mappings +pkg_dovecot_autoconfig() { + local args="$@" + for x in $args; do + local package="${x%:*}" + local option="${x#*:}" + [ ! -z "$option" ] || option="$package" + if pkginstalled -f "$package"; then + pkgprefix -t "$package" + var_append extraconfopt ' ' "--with-$option" + case $package in + *sql*) enable_sql=true ;; + esac + fi + done + # generic SQL support/build drivers as plugins + if $enable_sql; then + var_append extraconfopt ' ' "--with-sql=plugin" + fi +} +pkg_dovecot_autoconfig "$pkg_dovecot_options"