# -*- 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

name                mcabber
version             1.1.2
license             GPL-2+
categories          net
maintainers         nomaintainer
description         Console Jabber client
long_description    mcabber is a small Jabber console client. It includes features like \
                    SSL, MUC, history logging, command completion, OpenPGP encryption, \
                    OTR and external action triggers.
homepage            https://mcabber.com
master_sites        ${homepage}/files/
use_bzip2           yes

checksums           rmd160  e5992f9415249b4dc7082cd024c5d1d041657c6f \
                    sha256  c4a1413be37434b6ba7d577d94afb362ce89e2dc5c6384b4fa55c3e7992a3160 \
                    size    651528

depends_lib-append  port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gpgme \
                    port:libgcrypt \
                    port:libiconv \
                    port:libotr \
                    port:loudmouth \
                    port:ncurses

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:cctools \
                    path:libexec/coreutils/libstdbuf.so:coreutils \
                    bin:gawk:gawk \
                    port:gettext \
                    port:grep \
                    port:gsed \
                    port:libtool \
                    port:pkgconfig

# To find GNU grep instead of system grep
configure.env-append GREP=${prefix}/libexec/gnubin/grep

configure.args      --enable-otr \
                    --with-libotr-prefix=${prefix}/lib \
                    --with-libotr-inc-prefix=${prefix}/include

configure.env       LIBTOOL=glibtool

patchfiles          patch-autogen.sh.diff

pre-configure {
    system -W ${worksrcpath} "./autogen.sh"
}

# TODO
# Bug #26 on mcabber - see pre-configure section for a workaround
variant aspell description {Use aspell spell checking - remember to install a dictionary, too} {
    configure.args-append   --enable-aspell
    depends_lib-append      port:aspell
}

post-configure {
    reinplace "s|#define HAVE_LOCALCHARSET_H 1|\/\* #undef HAVE_LOCALCHARSET_H \*\/|g" ${worksrcpath}/${name}/config.h
}

post-destroot {
     copy ${worksrcpath}/mcabberrc.example \
          ${destroot}${prefix}/share/${name}/
}

notes "
If this is your first install, follow the below instructions to get started:
    mkdir ~/.mcabber
    chmod 0700 ~/.mcabber
    cp ${prefix}/share/${name}/mcabberrc.example ~/.mcabber/mcabberrc
Then edit that file to set your username and server (or only the 'jid' option).
"

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     {<tt>mcabber ([0-9.]*)</tt>}
