# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           legacysupport 1.1

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

name                msmtp
version             1.8.31
revision            0
categories          mail
maintainers         {ra1nb0w @ra1nb0w} openmaintainer
license             GPL-3+
description         SMTP client that can be used as an SMTP plugin for Mutt
long_description    msmtp is an SMTP client that can be used as an SMTP \
                    plugin for Mutt and probably other MUAs (mail user \
                    agents). It forwards mails to an SMTP server which \
                    does the delivery. To use this program, create a \
                    configuration file with your mail account(s) and tell \
                    your MUA to call msmtp instead of /usr/sbin/sendmail.

homepage            https://marlam.de/msmtp/
master_sites        ${homepage}releases/
use_xz              yes

checksums           rmd160  181f89009aae78f3281591939c68ac4be5b9e55a \
                    sha256  c262b11762d8582a3c6d6ca8d8b2cca2b1605497324ca27cc57fdc145a27119f \
                    size    455820

depends_build       path:bin/pkg-config:pkgconfig
depends_lib         port:gettext \
                    path:lib/pkgconfig/gnutls.pc:gnutls \
                    port:libgsasl \
                    port:libidn2

configure.args      --disable-silent-rules \
                    --with-libgsasl \
                    --without-libsecret

startupitem.name    msmtpd

platform macosx {
    configure.args-append   --with-macosx-keyring
}

livecheck.url       https://marlam.de/msmtp/download/

variant mta description {Use msmtp as the system MTA} {
    conflicts               postfix opensmtpd

    configure.args-append   --with-msmtpd

    startupitem.create      yes
    startupitem.executable  ${prefix}/bin/msmtpd
}

post-destroot {
    if {[variant_isset mta]} {
        ln -s ${prefix}/bin/msmtp ${destroot}${prefix}/sbin/sendmail
    }
}
