# -*- 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 65421 2010-03-26 01:39:32Z ryandesign@macports.org $

PortSystem          1.0

name                centerim
version             4.22.9
revision            2
categories          net
maintainers         nomaintainer
platforms           darwin
description         Console multi-IM client.
long_description    Console client for AIM/ICQ/Yahoo/MSN/IRC/LiveJournal.
checksums           md5     c43911508205e0277529230c8316a298 \
                    sha1    ebe9f4ee2064a2fa10f1084ce26083ccd295673e \
                    rmd160  253007e466a211ec740f7843538e4f686ab95cad
homepage            http://www.centerim.org/
master_sites        ${homepage}download/releases/
depends_lib         port:libiconv port:gettext port:ncurses port:openssl \
                    port:jpeg port:gpgme
patchfiles          patch-configure.diff

configure.args      --disable-msn \
                    --disable-yahoo \
                    --with-libiconv-prefix=${prefix} \
                    --with-libintl-prefix=${prefix} \
                    --with-ssl --with-openssl=${prefix}/include \
                    --with-libjpeg --with-gpgme-prefix=${prefix} \
                    --without-libcurl
build.type          gnu

variant msn description {Enable MSN support (requires curl+ssl)} {
    depends_build-append port:pkgconfig
    depends_lib-append port:curl
    configure.args-delete --disable-msn --without-libcurl
    configure.args-append --with-libcurl=${prefix}
    pre-fetch {
        set fd [open "|pkg-config --variable=supported_features libcurl"]
        eval set features [gets $fd]
        close $fd
        if {[lsearch -exact $features SSL] == -1} {
            return -code error "curl must be installed with +ssl to enable MSN support."
        }
    }
}
variant allproto description {Enable support for all protocols (requires curl+ssl)} {
    depends_build-append port:pkgconfig
    depends_lib-append port:curl
    configure.args-delete --disable-msn --disable-yahoo --without-libcurl
    configure.args-append --with-libcurl=${prefix}
    pre-fetch {
        set fd [open "|pkg-config --variable=supported_features libcurl"]
        eval set features [gets $fd]
        close $fd
        if {[lsearch -exact $features SSL] == -1} {
            return -code error "curl must be installed with +ssl to enable MSN and Yahoo support."
        }
    }
}

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