Unverified Commit bb9143e0 authored by Daniel Silverstone's avatar Daniel Silverstone
Browse files

exim: Add pgsql, sqlite, json, and srs support



While disabled by default, this adds support for postgresql,
sqlite, and json lookups in exim.  Also this adds support for
enabling exim's sender-rewrite-scheme capability.

Signed-off-by: default avatarDaniel Silverstone <dsilvers@digital-scurf.org>
parent e1e28237
Loading
Loading
Loading
Loading
+31 −1
Original line number Diff line number Diff line
@@ -3,11 +3,15 @@
, procps, killall
, enableLDAP ? false, openldap
, enableMySQL ? false, libmysqlclient, zlib
, enablePgSQL ? false, postgresql
, enableSqlite ? false, sqlite
, enableAuthDovecot ? false, dovecot
, enablePAM ? false, pam
, enableSPF ? true, libspf2
, enableDMARC ? true, opendmarc
, enableRedis ? false, hiredis
, enableJSON ? false, jansson
, enableSRS ? false,
}:
let
  perl' = perl.withPackages (p: with p; [ FileFcntlLock ]);
@@ -26,11 +30,14 @@ in stdenv.mkDerivation rec {
  buildInputs = [ coreutils db openssl perl' pcre2 libxcrypt ]
    ++ lib.optional enableLDAP openldap
    ++ lib.optionals enableMySQL [ libmysqlclient zlib ]
    ++ lib.optional enablePgSQL postgresql
    ++ lib.optionals enableSqlite [ sqlite sqlite.dev zlib ]
    ++ lib.optional enableAuthDovecot dovecot
    ++ lib.optional enablePAM pam
    ++ lib.optional enableSPF libspf2
    ++ lib.optional enableDMARC opendmarc
    ++ lib.optional enableRedis hiredis;
    ++ lib.optional enableRedis hiredis
    ++ lib.optional enableJSON jansson;

  configurePhase = ''
    runHook preConfigure
@@ -71,9 +78,25 @@ in stdenv.mkDerivation rec {
        s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz:
        s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${libmysqlclient.dev}/include/mysql/:
      ''}
      ${lib.optionalString enablePgSQL ''
        s:^# \(LOOKUP_PGSQL=yes\)$:\1:
        s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lpq -L${postgresql.lib}/lib:
        s:^# \(LOOKUP_LIBS\)=.*:\1=-lpq -L${postgresql.lib}/lib:
        s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${postgresql}/include:
      ''}
      ${lib.optionalString enableSqlite ''
        s:^# \(LOOKUP_SQLITE=yes\)$:\1:
        s:^# \(LOOKUP_SQLITE_PC=sqlite3\)$:\1:
        s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lsqlite3 -L${sqlite}/lib:
        s:^# \(LOOKUP_LIBS\)=.*:\1=-lsqlite3 -L${sqlite}/lib -lssl -lm -lpthread -lz:
        s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${sqlite.dev}/include:
      ''}
      ${lib.optionalString enableAuthDovecot ''
        s:^# \(AUTH_DOVECOT\)=.*:\1=yes:
      ''}
      ${lib.optionalString enableSRS ''
        s:^# \(SUPPORT_SRS\)=.*:\1=yes:
      ''}
      ${lib.optionalString enablePAM ''
        s:^# \(SUPPORT_PAM\)=.*:\1=yes:
        s:^\(EXTRALIBS_EXIM\)=\(.*\):\1=\2 -lpam:
@@ -94,6 +117,13 @@ in stdenv.mkDerivation rec {
        s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${hiredis}/include/hiredis/:
        s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${hiredis}/include/hiredis/:
      ''}
      ${lib.optionalString enableJSON ''
        s:^# \(LOOKUP_JSON=yes\)$:\1:
        s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -ljansson -L${jansson}/lib:
        s:^# \(LOOKUP_LIBS\)=.*:\1=-ljansson -L${jansson}/lib:
        s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${jansson}/include:
        s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${jansson}/include:
      ''}
      #/^\s*#.*/d
      #/^\s*$/d
    ' < src/EDITME > Local/Makefile