--- /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/mail/exim/Portfile	2014-07-14 00:30:14.000000000 +0200
+++ Portfile	2015-05-08 10:27:41.000000000 +0200
@@ -4,10 +4,10 @@
 PortSystem              1.0
 
 name                    exim
-version                 4.82.1
-revision                1
-checksums               rmd160  2caa80ed8b5fef07fd0449dc5ac7958681466a2d \
-                        sha256  51798cead70b9ca03df88afb63f7a0cabedee8ef82c02bd18d67591c08b14500
+version                 4.85
+revision                0
+checksums               rmd160  334e5eeb9242b3fff49bd581b8cb22c12c0e8215 \
+                        sha256  13211f2bbc5400d095a9b4be075eb1347e0d98676fdfe4be8a3b4d56281daaa4
 
 categories              mail
 license                 GPL-2
@@ -42,6 +42,8 @@
 
 set exim_user           exim
 
+add_users ${exim_user} group=mail realname=Exim
+
 use_parallel_build      no
 
 universal_variant       no
@@ -69,7 +71,6 @@
     reinplace "s|# Exim: OS-specific make file for Darwin (Mac OS X).|INCLUDE=-I${prefix}/include/db44|g" ${worksrcpath}/OS/Makefile-Darwin
     reinplace "s|DBMLIB =|DBMLIB=${prefix}/lib/db44/libdb-4.dylib|g" ${worksrcpath}/OS/Makefile-Darwin
     reinplace "s|/etc/aliases|${destroot}${prefix}/etc/aliases|g" ${worksrcpath}/scripts/exim_install
-    adduser ${exim_user} gid=[existsgroup mail]
 }
 
 build.args              FULLECHO=
@@ -90,12 +91,24 @@
     reinplace "s|__PREFIX|${prefix}|g" ${destroot}${prefix}/share/exim/exim.sh
 }
 
-variant mysql4 conflicts mysql5 description {build exim with support for mysql4 lookups} {
+variant mysql4 conflicts mysql5 mysql51 mysql56 mariadb description {build exim with support for mysql4 lookups} {
     depends_lib-append  port:mysql4
 }
 
-variant mysql5 conflicts mysql4 description {build exim with support for mysql5 lookups} {
-    depends_lib-append  path:bin/mysql_config5:mysql5
+variant mysql5 conflicts mysql4 mysql56 mariadb requires mysql51 description {Legacy compatibility variant} {
+    # stub do nothing
+}
+
+variant mysql51 conflicts mysql4 description {build exim with support for mysql51 lookups} {
+    depends_lib-append      port:mysql51
+}
+
+variant mysql56 conflicts mysql4 mysql5 mysql51 mariadb description {build with with support for mysql56 lookups} {
+    depends_lib-append      port:mysql56
+}
+
+variant mariadb conflicts mysql4 mysql5 mysql51 mysql56 description {build with mariadb port for mysql lookups} {
+    depends_lib-append      port:mariadb
 }
 
 variant ldap conflicts macports_ldap description {build exim with support for ldap lookups using the shipped ldap} {
@@ -117,6 +130,9 @@
     # settings common to any lookup
     if {[variant_isset mysql4]
         ||  [variant_isset mysql5]
+        ||  [variant_isset mysql51]
+        ||  [variant_isset mysql56]
+        ||  [variant_isset mariadb]
         ||  [variant_isset ldap]
         ||  [variant_isset macports_ldap]
     } then {
@@ -128,10 +144,20 @@
             reinplace "s|^LOOKUP_LIBS=.*|& -L${prefix}/lib/mysql -lmysqlclient|g" ${worksrcpath}/Local/Makefile
             reinplace "s|^LOOKUP_INCLUDE=.*|& -I${prefix}/include/mysql -I ${prefix}/include|g" ${worksrcpath}/Local/Makefile
         }
-        if {[variant_isset mysql5]} {
+        if {[variant_isset mysql5] || [variant_isset mysql51]} {
+            reinplace "s|^# LOOKUP_MYSQL=yes|LOOKUP_MYSQL=yes|g" ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_LIBS=.*|& -L${prefix}/lib/mysql51/mysql -lmysqlclient |g" ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_INCLUDE=.*|& -I${prefix}/include/mysql51/mysql |g"  ${worksrcpath}/Local/Makefile
+        }
+        if {[variant_isset mysql56]} {
+            reinplace "s|^# LOOKUP_MYSQL=yes|LOOKUP_MYSQL=yes|g" ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_LIBS=.*|& -L${prefix}/lib/mysql56/mysql -lmysqlclient |g" ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_INCLUDE=.*|& -I${prefix}/include/mysql56/mysql |g"  ${worksrcpath}/Local/Makefile
+        }
+        if {[variant_isset mariadb]} {
             reinplace "s|^# LOOKUP_MYSQL=yes|LOOKUP_MYSQL=yes|g" ${worksrcpath}/Local/Makefile
-            reinplace "s|^LOOKUP_LIBS=.*|& -L${prefix}/lib/mysql5/mysql -lmysqlclient |g" ${worksrcpath}/Local/Makefile
-            reinplace "s|^LOOKUP_INCLUDE=.*|& -I${prefix}/include/mysql5/mysql |g"  ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_LIBS=.*|& -L${prefix}/lib/mariadb/mysql -lmysqlclient |g" ${worksrcpath}/Local/Makefile
+            reinplace "s|^LOOKUP_INCLUDE=.*|& -I${prefix}/include/mariadb/mysql |g"  ${worksrcpath}/Local/Makefile
         }
         if {[variant_isset ldap]} {
             reinplace "s|^# LOOKUP_LDAP=yes|LOOKUP_LDAP=yes|g"  ${worksrcpath}/Local/Makefile
