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

PortSystem          1.0

name                mcabber
version             1.0.3
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            http://mcabber.com/
platforms           darwin
master_sites        http://mcabber.com/files/
use_bzip2           yes

checksums           rmd160  38895b85cb27976ad650e88f229e41dcfa5f479f \
                    sha256  44e6bb0aa0c399261fc212c386a3c2540db133e7593592247ee1621df659139a

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

depends_build       port:autoconf \
                    port:automake \
                    port:coreutils \
                    bin:gawk:gawk \
                    port:libtool \
                    port:pkgconfig \
                    port:cctools \
                    port:grep \
                    port:gsed

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>}