# $Id: Portfile 78762 2011-05-21 15:29:21Z jmr@macports.org $

PortSystem          1.0

name                mcabber
version             0.9.10
categories          net
maintainers         hitzemann.org:simon
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           md5     887415d16c32af58eab2ec2d9bb17fa6 \
                    sha1    6ff8222ed8956e078a3c3d519013a125e715e499 \
                    rmd160  656818b304b9088097ad2a0fe485f38cd0e704fc

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

depends_build        bin:gawk:gawk \
                     bin:pkg-config:pkgconfig \
                     bin:gmkdir:coreutils

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

configure.env       LIBTOOL=glibtool

patchfiles          patch-autogen.sh.diff

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

# TODO
# Bug #26 on mcabber - see pre-configure section for a workaround
variant gnutls \
description "Use GNUTLS for TLS connections" {
                    configure.args-delete --without-ssl
                    configure.args-append --with-ssl
                    configure.args-append --with-libgnutls-extra-prefix=${prefix}
                    depends_lib-append port:gnutls
               }

variant ssl \
description "Use OpenSSL for SSL connections" {
                    configure.args-delete --without-ssl
                    configure.args-delete --without-openssl
                    configure.args-append --with-ssl
                    configure.args-append --with-openssl=${prefix}
                    depends_lib-append port:openssl
               }

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}/config.h
               }
