# -*- 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           elisp                       1.0
PortGroup           github                      1.0
PortGroup           meson                       1.0
PortGroup           compiler_blacklist_versions 1.0

github.setup        djcb mu 1.12.7 v
github.tarball_from archive
checksums           rmd160  f789634e7462f9b53ae65424d2a03a7e081040c7 \
                    sha256  9212cf0f9d3b6342d5a0aea40a3d5b5116fe4da198719cccab1f8fa6683bd8b4 \
                    size    966457
revision            0

categories          mail
license             GPL-3
maintainers         {ra1nb0w @ra1nb0w} openmaintainer
description         Command-line tools to index and search email (aka maildir-utils)
long_description \
    mu is a set of command-line tools for Linux/Unix that enable you to \
    quickly find the e-mails you are looking for. First, a tool called \
    mu-index fills a database with information about all your e-mails. After \
    that, you can easily search for them, using mu-find and its dedicated \
    query language.
homepage            https://www.djcbsoftware.nl/code/mu/

compiler.c_standard     1999
compiler.cxx_standard   2017

# https://trac.macports.org/ticket/63364
compiler.blacklist      {clang < 900}

set py_ver              3.12
set py_ver_nodot        [string map {. {}} ${py_ver}]
configure.python        ${prefix}/bin/python${py_ver}

post-patch {
    reinplace -W ${worksrcpath} "s|/usr/bin/env python3|${configure.python}|" \
                        build-aux/date.py
}

depends_build-append \
    path:bin/pkg-config:pkgconfig \
    port:python${py_ver_nodot}

depends_lib-append \
    port:gmime3 \
    port:xapian-core

variant emacs description {Build with emacs bindings} {
    depends_lib-append      path:${emacs_binary}:${emacs_binary_provider}
    configure.env-append    EMACS=${emacs_binary}
    build.env-append        ELCFLAGS=-Q
    configure.args-append   -Demacs=${emacs_binary}
}

variant guile description {Build with Guile 3.0/Scheme bindings} {
    depends_lib-append      port:guile-3.0
    configure.args-append   -Dguile=enabled
}

# disable "-rc" versions for livecheck
github.livecheck.regex  {([0-9.]+)}