# -*- 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
# $Id: Portfile 117583 2014-03-04 12:54:05Z raimue@macports.org $

PortSystem      1.0
PortGroup       active_variants 1.1

name            claws-mail
version         3.9.3
categories      mail news
platforms       darwin
license         GPL-3+
maintainers     piermont.com:perry openmaintainer

description     A lightweight and very featureful GTK+ based e-mail and news client

long_description Currently, many features are supported in Claws Mail \
                including POP3, IMAP, NNTP, multiple accounts, \
                threading, filtering, MIME attachments, APOP, SMTP \
                AUTH, SSL, IPv6, GnuPG, internalization, plugins, \
                a filtering/processing mechanism, extra folder \
                properties and much more.

homepage        http://www.claws-mail.org/
master_sites    sourceforge:project/sylpheed-claws/Claws%20Mail/${version}

checksums       rmd160  e9258dd2323010596782e2090a40f3fe674344e2 \
                sha256  53aacceab45af6c3ee1f0668956a6e3328d21ac4efcfc0aa8dfd7d7552a62372

use_bzip2       yes

depends_build   port:pkgconfig
depends_lib     port:gtk2 \
                port:libetpan \
                port:gpgme \
                port:compface \
                port:gtkspell2 \
                port:aspell \
                port:gnutls \
                port:libgcrypt \
                port:enchant \
                path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk

# claws uses gdk/gdkx.h, which is not installed by gtk2 +quartz.
require_active_variants \
                gtk2 x11

# TODO: Check ${configure.cxx_stdlib} directly once MacPorts 2.3 is released
platform darwin {
    set cxxstdlib {}

    if {[info exists configure.cxx_stdlib] &&
        ${configure.cxx_stdlib} ne {} &&
        [string match *clang* ${configure.cxx}]} {
        set cxxstdlib ${configure.cxx_stdlib}
    } elseif {[string match *clang* ${configure.cxx}] &&
              ${os.major} >= 13} {
        set cxxstdlib libc++
    } else {
        set cxxstdlib libstdc++
    }

    if {${cxxstdlib} eq "libstdc++"} {
       depends_lib-delete path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk
       depends_lib-append path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk-2.0
    }
}

configure.args  --disable-jpilot \
                --disable-acpi_notifier-plugin \
                --disable-archive-plugin \
                --disable-bogofilter-plugin \
                --disable-bsfilter-plugin \
                --disable-clamd-plugin \
                --disable-spamassassin-plugin \
                --disable-spam_report-plugin \
                --disable-tnef_parse-plugin \
                --enable-manual \
                --enable-ipv6 \
                --enable-crash-dialog

livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}
