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

github.setup        OfflineIMAP offlineimap3 8.0.1 v
github.tarball_from archive
name                offlineimap
revision            0

categories          mail python
platforms           {darwin any}
license             {GPL-2+ OpenSSLException}
maintainers         nomaintainer
supported_archs     noarch

description         IMAP/Maildir synchronization and reader support
long_description    OfflineIMAP is a tool to simplify your e-mail reading. \
                    With OfflineIMAP, you can: \
                    - Read the same mailbox from multiple computers, and \
                      have your changes (deletions, etc.) be automatically \
                      reflected on all computers \
                    - Use various mail clients to read a single mail box \
                    - Read mail while offline (on a laptop) and have all \
                      changes synchronized when you get connected again \
                    - Read IMAP mail with mail readers that do not support \
                      IMAP \
                    - Use SSL (secure connections) to read IMAP mail even \
                      if your reader doesn't support SSL \
                    - Synchronize your mail using a completely safe and \
                      fault-tolerant algorithm. (At least I think it is!) \
                    - Customize which mailboxes to synchronize with regular \
                      expressions or lists \
                    - Synchronize your mail two to four times faster than \
                      with other tools or other mail readers' internal IMAP \
                      support \
                    In short, OfflineIMAP is a tool to let you read mail \
                    how YOU want to.

homepage            https://www.offlineimap.org

checksums           rmd160  13691b2fc80e56988109c65a6df1d5f540c6703e \
                    sha256  82ce54136465ea1cce62f4e961e8c155ac3eee2149fa812763629448902d7d69 \
                    size    706574



python.default_version 314
python.pep517       no

depends_build-append \
                    port:py${python.version}-docutils \
                    port:py${python.version}-sphinx \
                    port:py${python.version}-setuptools \
                    port:asciidoc \
                    port:docbook-xsl-nons

depends_lib-append  path:share/curl/curl-ca-bundle.crt:curl-ca-bundle \
                    port:py${python.version}-distro \
                    port:py${python.version}-gssapi \
                    port:py${python.version}-imaplib2 \
                    port:py${python.version}-keyring \
                    port:py${python.version}-rfc6555

patchfiles          patch-docs_doc-src_conf.py.diff

post-patch {
    if {${prefix} ne "/opt/local"} {
        reinplace -W ${worksrcpath} "s|/opt/local/share/curl/curl-ca-bundle.crt|${prefix}/share/curl/curl-ca-bundle.crt|g" \
            offlineimap/utils/distro_utils.py
    }
}

post-build {
    system -W ${worksrcpath} "PATH='${python.prefix}/bin:$env(PATH)' make docs"
}

post-destroot {
    xinstall -m 0644 -W ${worksrcpath} \
        COPYING Changelog.md \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 ${worksrcpath}/offlineimap.conf \
        ${destroot}${prefix}/etc/offlineimap.conf.sample
    xinstall -m 0644 ${worksrcpath}/offlineimap.conf.minimal \
        ${destroot}${prefix}/etc/offlineimap.conf.minimal.sample
}
