diff options
Diffstat (limited to 'src/meson.build')
-rw-r--r-- | src/meson.build | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..8f9af12 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,536 @@ +inc = 'include' + +subdir(inc) + +config = configuration_data() +cc = meson.get_compiler('c') + +if cc.has_member('struct sockaddr', 'sa_len', prefix : '#include <sys/socket.h>') + config.set('HASSALEN', true) +endif + +if cc.has_function('getspnam', prefix : '#include <shadow.h>') + config.set('HASGETSPNAM', true) +elif cc.has_function('getuserpw', prefix : '#include <userpw.h>') + config.set('HASGETUSERPW', true) +endif + +if cc.has_function('mkfifo', prefix : '#include <sys/stat.h>') + config.set('HASMKFIFO', true) +endif + +if cc.has_header('utmp.h') + config.set('HASUTMP', true) +endif + +if idn2_dep.found() + config.set('IDN2', true) +endif + +auto_qmail = run_command('head', '-n1', '../conf-home', check : true).stdout().strip() +config.set('auto_qmail', auto_qmail) + +config.set('auto_usera', 'alias') + +config.set('auto_split', get_option('split')) +config.set('auto_patrn', get_option('patrn')) +config.set('auto_spawn', get_option('spawn')) + +user_groups = [ + 'alias', 'qmaild', 'qmaill', 'qmailp', 'qmailq', 'qmailr', 'qmails', + 'sqmail', 'nofiles', +] + +foreach id : user_groups + config.set(id, get_option(id)) +endforeach + +configure_file( + configuration : config, + input : inc / 'fehsqm-config.h.in', + output : 'fehsqm-config.h', + install_dir : get_option('includedir') / sqmail_hdrs_subdir, + install_tag : 'devel') + +add_project_arguments('-DUSE_CONFIG', language : 'c') + +auto_break = get_option('break') +assert(auto_break[0] == auto_break) +assert(auto_break not in ['"', '\\']) +auto_break_c = custom_target(output : 'auto_break.c', + command : ['echo', 'char', 'auto_break', '[]', '=', f'"@auto_break@"', ';'], + capture : true) + + +dkim_slib = static_library('qdkim', + 'dkim.cpp', 'dkimbase.cpp', 'dkimsign.cpp', 'dkimverify.cpp', + include_directories : inc, + dependencies : dnsresolv_dep, + build_by_default : false) + +datetime_slib = static_library('datetime', 'datetime.c', 'datetime_un.c', + include_directories : inc, + build_by_default : false) + + +if get_option('build-srs') + + executable('srsforward', + 'srsforward.c', 'qmail.c', 'control.c', 'constmap.c', 'srs2.c', 'sha1.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('srsreverse', + 'srsreverse.c', 'qmail.c', 'control.c', 'constmap.c', 'srs2.c', 'sha1.c', + auto_break_c, + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-user') + + executable('qmail-getpw', 'qmail-getpw.c', auto_break_c, + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-newu', 'qmail-newu.c', dependencies : qlibs_dep, install : true) + + executable('qmail-pw2u', 'qmail-pw2u.c', 'constmap.c', 'control.c', auto_break_c, + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-newmrh', 'qmail-newmrh.c', dependencies : qlibs_dep, install : true) + +endif + + +if get_option('build-server') + + executable('qmail-qmtpd', + 'qmail-qmtpd.c', 'rcpthosts.c', 'control.c', 'constmap.c', 'received.c', + 'date822fmt.c', 'now.c', 'qmail.c', auto_break_c, + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-qmqpd', + 'qmail-qmqpd.c', 'received.c', 'now.c', 'date822fmt.c', 'qmail.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-smtpd', + 'qmail-smtpd.c', 'rcpthosts.c', 'commands.c', 'ipme.c', 'ipalloc.c', + 'constmap.c', 'control.c', 'received.c', 'recipients.c', 'mfrules.c', + 'tls_start.c', 'smtpdlog.c', 'dns.c', 'date822fmt.c', 'now.c', 'qmail.c', + 'wildmat.c', 'spf.c', 'spfdnsip.c', 'base64.c', auto_break_c, + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : [qlibs_dep, dnsresolv_dep]) + +endif + + +if get_option('build-queue') + + executable('qmail-qread', + 'qmail-qread.c', 'fmtqfn.c', 'readsubdir.c', 'date822fmt.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-tcpto', 'qmail-tcpto.c', 'now.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-tcpok', 'qmail-tcpok.c', dependencies : qlibs_dep, install : true) + +endif + + +if get_option('build-pam') + + executable('qmail-authuser', + 'qmail-authuser.c', 'control.c', 'hmac_md5.c', 'md5c.c', + 'constmap.c', 'sha1.c', 'sha256.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, crypt_dep]) + + executable('qmail-smtpam', + 'qmail-smtpam.c', 'control.c', 'now.c', 'dns.c', 'constmap.c', 'ipalloc.c', + 'ipme.c', 'quote.c', 'tcpto.c', 'tls_timeoutio.c', 'tls_errors.c', + 'tls_remote.c', 'dns_tlsa.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep, ucspissl_dep, ssl_dep, crypto_dep]) + + executable('qmail-vmailuser', 'qmail-vmailuser.c', 'control.c', 'constmap.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-postgrey', 'qmail-postgrey.c', dependencies : qlibs_dep, install : true) + +endif + + +if get_option('build-log') + + executable('splogger', 'splogger.c', dependencies : qlibs_dep, install : true) + executable('qmail-mrtg', 'qmail-mrtg.c', 'now.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + executable('tai64nfrac', 'tai64nfrac.c', dependencies : qlibs_dep, install : true) + +endif + + +if get_option('build-control') + + executable('qmail-badmimetypes', 'qmail-badmimetypes.c', + install : true, + dependencies : qlibs_dep) + + executable('qmail-badloadertypes', 'qmail-badloadertypes.c', + install : true, + dependencies : qlibs_dep) + + executable('qmail-mfrules', 'qmail-mfrules.c', dependencies : qlibs_dep, install : true) + + executable('qmail-recipients', 'qmail-recipients.c', dependencies : qlibs_dep, install : true) + + executable('qmail-showctl', 'qmail-showctl.c', 'control.c', auto_break_c, + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-forward') or get_option('build-mbox') + executable('forward', 'forward.c', 'qmail.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) +endif + + +if get_option('build-forward') + + executable('fastforward', 'fastforward.c', 'qmail.c', 'strset.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('printforward', 'printforward.c', dependencies : qlibs_dep, install : true) + + executable('setforward', 'setforward.c', dependencies : qlibs_dep, install : true) + + executable('newaliases', 'newaliases.c', 'token822.c', 'control.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('printmaillist', 'printmaillist.c', dependencies : qlibs_dep, install : true) + + executable('setmaillist', 'setmaillist.c', dependencies : qlibs_dep, install : true) + + executable('newinclude', 'newinclude.c', 'token822.c', 'control.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-setup') + + executable('install-sqmail', 'install.c', 'hier.c', 'fifo.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('instcheck', 'instcheck.c', 'hier.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-pop') + + executable('qmail-popup', 'qmail-popup.c', 'commands.c', 'now.c', 'tls_start.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-pop3d', + 'qmail-pop3d.c', 'commands.c', 'maildir.c', 'prioq.c', 'now.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-dns') + + executable('dnscname', 'dnscname.c', 'dns.c', 'ipalloc.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnsptr', 'dnsptr.c', 'dns.c', 'ipalloc.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnsip', 'dnsip.c', 'dns.c', 'ipalloc.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnsmxip', 'dnsmxip.c', 'ipalloc.c', 'dns.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnsfq', 'dnsfq.c', 'dns.c', 'ipalloc.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnstlsa', 'dnstlsa.c', 'dns_tlsa.c', 'ipalloc.c', 'dns.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('dnstxt', 'dnstxt.c', 'ipalloc.c', 'dns.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('hostname', 'hostname.c', dependencies : [qlibs_dep, dnsresolv_dep], install : true) + + executable('ipmeprint', 'ipmeprint.c', 'ipme.c', 'ipalloc.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep]) + + executable('spfquery', + 'spfquery.c', 'spf.c', 'ipme.c', 'ipalloc.c', 'now.c', 'dns.c', 'spfdnsip.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : [qlibs_dep, dnsresolv_dep]) + +endif + + +if get_option('build-dkim') + + executable('qmail-dkim', + 'qmail-dkim.cpp', 'dkim.cpp', 'dkimbase.cpp', 'dkimsign.cpp', 'dkimverify.cpp', + include_directories : inc, + install : true, + link_with : dkim_slib, + dependencies : [qlibs_dep, dnsresolv_dep, ssl_dep, crypto_dep]) + + executable('qmail-dksign', + 'qmail-dksign.c', 'control.c', 'constmap.c', 'fmtqfn.c', 'rcpthosts.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-dkverify', + 'qmail-dkverify.c', 'control.c', 'fmtqfn.c', 'qmail.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-clients') + + executable('qmail-remote', + 'qmail-remote.c', 'control.c', 'tcpto.c', 'now.c', 'dns.c', 'ipalloc.c', + 'ipme.c', 'quote.c', 'tls_timeoutio.c', 'tls_errors.c', 'tls_remote.c', + 'dns_tlsa.c', 'base64.c', 'constmap.c', 'md5c.c', 'hmac_md5.c', + include_directories : inc, + install : true, + dependencies : [qlibs_dep, dnsresolv_dep, idn2_dep, ssl_dep, crypto_dep, ucspissl_dep]) + + executable('qmail-qmqpc', 'qmail-qmqpc.c', 'control.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('sendmail', 'sendmail.c', dependencies : qlibs_dep, install : true) + +endif + + +if get_option('build-mbox') + + executable('predate', 'predate.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('preline', 'preline.c', dependencies : qlibs_dep, install : true) + + executable('condredirect', 'condredirect.c', 'qmail.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('bouncesaying', 'bouncesaying.c', dependencies : qlibs_dep, install : true) + + executable('except', 'except.c', dependencies : qlibs_dep, install : true) + + executable('maildirmake', 'maildirmake.c', dependencies : qlibs_dep, install : true) + + executable('maildir2mbox', + 'maildir2mbox.c', 'maildir.c', 'prioq.c', 'now.c', 'myctime.c', 'gfrom.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('maildirwatch', + 'maildirwatch.c', 'hfield.c', 'headerbody.c', 'maildir.c', 'prioq.c', 'now.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qbiff', 'qbiff.c', 'headerbody.c', 'hfield.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qreceipt', + 'qreceipt.c', 'headerbody.c', 'hfield.c', 'quote.c', 'token822.c', 'qmail.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-base') + + executable('qmail-local', + 'qmail-local.c', 'qmail.c', 'quote.c', 'now.c', 'gfrom.c', 'myctime.c', + auto_break_c, + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-rspawn', + 'qmail-rspawn.c', 'spawn.c', 'tcpto_clean.c', 'now.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-lspawn', 'qmail-lspawn.c', 'spawn.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-send', + 'qmail-send.c', 'qsutil.c', 'control.c', 'constmap.c', 'newfield.c', + 'prioq.c', 'trigger.c', 'fmtqfn.c', 'quote.c', 'now.c', 'readsubdir.c', + 'qmail.c', 'date822fmt.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-qmaint', + 'qmail-qmaint.c', 'fifo.c', 'fmtqfn.c', 'readsubdir.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-clean', + 'qmail-clean.c', 'fmtqfn.c', 'now.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + + executable('qmail-start', 'qmail-start.c', dependencies : qlibs_dep, install : true) + + executable('qmail-queue', + 'qmail-queue.c', 'triggerpull.c', 'fmtqfn.c', 'now.c', 'date822fmt.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-inject', + 'qmail-inject.c', 'headerbody.c', 'hfield.c', 'newfield.c', 'quote.c', 'now.c', + 'control.c', 'date822fmt.c', 'qmail.c', 'token822.c', 'constmap.c', + include_directories : inc, + install : true, + link_with : datetime_slib, + dependencies : qlibs_dep) + + executable('qmail-todo', + 'qmail-todo.c', 'control.c', 'constmap.c', 'trigger.c', 'fmtqfn.c', 'now.c', + 'qsutil.c', 'readsubdir.c', + include_directories : inc, + install : true, + dependencies : qlibs_dep) + +endif + + +if get_option('build-analog') + + executable('matchup', 'matchup.c', dependencies : qlibs_dep, install : true) + + executable('columnt', 'columnt.c', dependencies : qlibs_dep, install : true) + +endif + + +#it-analog: ddist deferrals failures senders successes suids \ +# recipients rhosts rhosts rxdelay xqp xrecipient xsender zddist zdeferrals \ +# zfailures zrecipients zrhosts zrxdelay zsenders zsendmail zsuccesses zsuids zoverall +#it-mbox: datemail +#it-clients: mailsubj +#it-setup: config config-fast +#it-log: qmail-mrtg-queue +#it-queue: qmail-qstat qmail-upq + +#hasmkffo.h: trymkffo.c compile load +# ( ( ./compile trymkffo.c && ./load trymkffo ) >/dev/null \ +# 2>&1 \ +# && echo \#define HASMKFIFO 1 || exit 0 ) > hasmkffo.h +# rm -f trymkffo.o trymkffo +# +#hasshsgr.h: chkshsgr warn-shsgr tryshsgr.c compile load +# ./chkshsgr || ( cat warn-shsgr; exit 1 ) +# ( ( ./compile tryshsgr.c \ +# && ./load tryshsgr && ./tryshsgr ) >/dev/null 2>&1 \ +# && echo \#define HASSHORTSETGROUPS 1 || exit 0 ) > \ +# hasshsgr.h +# rm -f tryshsgr.o tryshsgr |