# -*- 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           cmake 1.1
PortGroup           github 1.0

github.setup        kisli vmime 0.9.2 v
revision            3
checksums           rmd160  93e0ff43ba0221df62fc50198dd494dfc4b6a82e \
                    sha256  9874bf911a7dbc257297ab00f7541875da221ee8251a4218cc65abff6e362399 \
                    size    528830

name                libvmime
categories          mail devel
maintainers         nomaintainer
license             GPL-2+

description         library for dealing with RFC-822, 2822, MIME messages

long_description    VMime is a C++ class library for parsing, generating, or \
                    editing Internet RFC-822, 2822 and MIME messages. It is \
                    designed to provide a fast and easy way to manipulate \
                    Internet mail messages.

homepage            https://www.vmime.org/
github.tarball_from archive

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib         path:lib/pkgconfig/gnutls.pc:gnutls \
                    path:lib/pkgconfig/icu-uc.pc:icu \
                    port:libgsasl

post-extract {
    # DOS to UNIX line endings so we can patch
    reinplace -W ${worksrcpath} "s|\r||g" \
                    src/vmime/charsetConverter_icu.cpp
}

patchfiles          expected-value-in-expression.patch \
                    templates-must-have-C++-linkage.patch \
                    use-of-undeclared-identifier-FALSE.patch \
                    patch-unbreak-arm64-powerpc.diff \
                    patch-cxx17.diff \
                    patch-icu.diff \
                    patch-AI_NUMERICSERV.diff

# Required for ICU
compiler.cxx_standard   2017

configure.args      -DVMIME_BUILD_DOCUMENTATION=OFF \
                    -DVMIME_BUILD_SAMPLES=OFF \
                    -DVMIME_CHARSETCONV_LIB=icu \
                    -DVMIME_TLS_SUPPORT_LIB=gnutls

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        HACKING \
        README \
        ${destroot}${docdir}
}
