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: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2024-03-09 10:03:16 +00:00
parent e1e282374d
commit bb9143e01d
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -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