# -*- 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 105472 2013-04-22 13:05:12Z yeled@macports.org $

PortSystem          1.0
PortGroup           conflicts_build 1.0

name                notmuch
version             0.15.2
categories          mail
platforms           darwin
license             GPL-3+
maintainers         yeled
description         The mail indexer
long_description    "Not much mail" is what Notmuch thinks about your email\
                    collection. Even if you receive 12000 messages per month or have on the\
                    order of millions of messages that you've been saving for decades.\
                    Regardless, Notmuch will be able to quickly search all of it. It's just\
                    plain not much mail.

homepage            http://notmuchmail.org/
master_sites        ${homepage}releases/

checksums           rmd160  a29861f4a35fb4fee185ae9b527e2fa74ae44ba5 \
                    sha256  a6e8af6382ab6df4a944bbffda9eb22639612c047b94632168b4270f2af59c0d

depends_build       port:pkgconfig

depends_lib         port:xapian-bindings\
                    port:gmime\
                    port:talloc

patchfiles          patch-lib-Makefile.local.diff \
                    patch-Makefile.local.diff \
                    patch-bindings-python-notmuch-globals.py.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/bindings/python/notmuch/globals.py
}

# 0.14 failed to build when 0.11 was active with this error:
# notmuch-count.c:70:44: error: too many arguments to function call, expected 2, have 3
#                                NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch))
#                                                                 ^~~~~~~~
# /opt/local/include/notmuch.h:174:1: note: 'notmuch_database_open' declared here
# notmuch_database_t *
# ^
conflicts_build     ${name}

configure.args      --without-emacs
compiler.blacklist      clang macports-clang macports-clang-2.9 macports-clang-3.0 macports-clang-3.1 macports-clang-3.2 macports-clang-3.3

# disable silent rules
build.args          V=1

variant emacs description {EMACS support} {
    depends_lib-append      port:emacs
    configure.args-delete   --without-emacs
    configure.args-append   --with-emacs
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
