# -*- 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 106209 2013-05-18 22:03:21Z sean@macports.org $

PortSystem          1.0
PortGroup           github 1.0
PortGroup           python 1.0

github.setup        OfflineIMAP offlineimap 6.5.4 v
revision            2
categories          mail python
platforms           darwin
license             GPL-2+
maintainers         sean openmaintainer
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            http://offlineimap.org/

checksums           rmd160  bfe190520566525178dd53e386c97f16ef244535 \
                    sha256  ce8bec2a8368e6ea35ce5c6a3dc864006abc1d1327827e22aa70c4b082c41e87

# remove this next time offlineimap updates
dist_subdir         ${name}/${version}_1

python.default_version 27
python.link_binaries_suffix

depends_build       port:py${python.version}-docutils \
                    port:py${python.version}-sphinx

conflicts           offlineimap-devel

livecheck.type      regex
livecheck.regex     (\\d\\.\\d\\.\\d)\[^-\]

subport offlineimap-devel {
    github.setup        OfflineIMAP offlineimap a73b4b34652e
    name                offlineimap-devel
    version             6.5.4.99
    revision            1

    conflicts           offlineimap

    checksums           rmd160  f451344aea41c0eec8550e6420d581f275c412b2 \
                        sha256  eb06c0df9fd127db93a5c7fb6d6dc01a4645fe7d902e43d3b41846ea28f85d8d

    variant gmail description {Add experimental support for gmail labels} {
        github.setup        aroig offlineimap 8a40e6cec96c
        name                offlineimap-devel
        version             6.5.4.99
        revision            1

        checksums           rmd160  3bfd05bd12c48011669939225d433463e36a9358 \
                            sha256  a679fd51ad8a99a38cfa76b83c73c4c5e1caf2a0fe2232365b036ac74d7a38b9
    }
}

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

post-destroot {
    xinstall -m 644 -W ${worksrcpath} \
        COPYING Changelog.html Changelog.rst README \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath}/docs \
        MANUAL.rst \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/offlineimap.1 ${destroot}${prefix}/share/man/man1
    xinstall -m 644 ${worksrcpath}/offlineimap.conf \
        ${destroot}${prefix}/etc/offlineimap.conf.sample
    xinstall -m 644 ${worksrcpath}/offlineimap.conf.minimal \
        ${destroot}${prefix}/etc/offlineimap.conf.minimal.sample
}
