# -*- 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.32
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  5d4d011cbaed7f4dc0efa02f059ff65f905a81bb \
                    sha256  20cd58b58dd007acf7b937fa1a1e21f3afb3e9ef5bbcfb8b4f5650deadc64db4 \
                    size    456960

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