# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 68537 2010-06-05 18:23:18Z jeremyhu@macports.org $

PortSystem          1.0

name                pidgin
conflicts           finch
version             2.7.0
categories          net
platforms           darwin
maintainers         otherware.org:nefar
description         Multi-protocol Instant Messaging client
long_description    Pidgin is an Open Source clone of America OnLine's \
                    Instant Messenger client that uses GTK+ version 2.  It \
                    features multiple groups, group chat, user information \
                    fetching and registration, time stamping, and more.  It \
                    also supports other IM protocols, including Yahoo!, MSN, \
                    ICQ, Jabber, Napster, IRC, and Zephyr via included \
                    plugins.

homepage            http://www.pidgin.im/
master_sites        sourceforge
checksums           md5     63a36f91d29f5ac5a402ffd2d7dbbb72 \
                    sha1    7170aaae5e6f4039870eb5e0c5837d55285b758f \
                    rmd160  45e4b5a9acb9c4080ce6b33cedbf9b962883ca25
use_bzip2           yes

depends_build       port:libtool

depends_lib         port:audiofile \
                    port:dbus \
                    port:dbus-glib \
                    port:gtk2 \
                    port:libao \
                    port:libidn \
                    port:libxml2 \
                    port:nspr \
                    port:nss \
                    port:p5-xml-parser \
                    port:intltool

patchfiles          gst.diff

# nss is not universal
universal_variant   no

configure.args      --disable-avahi \
                    --disable-consoleui \
                    --disable-gstreamer \
                    --disable-gtkspell \
                    --disable-meanwhile \
                    --disable-nm \
                    --disable-screensaver \
                    --disable-sm \
                    --disable-startup-notification \
                    --disable-schemas-install \
                    --disable-vv \
                    --enable-nss \
                    --mandir=${prefix}/share/man \
                    --with-nspr-includes=${prefix}/include/nspr \
                    --with-nspr-libs=${prefix}/lib/nspr \
                    --with-nss-includes=${prefix}/include/nss \
                    --with-nss-libs=${prefix}/lib/nss \
                    --disable-dependency-tracking

# --disable-dependency-tracking was added because a +universal perl will result in
# PERL_CFLAGS containing multiple -arch arguments... this is the easiest workaround

configure.ldflags-append    -bind_at_load
configure.cppflags-append   -no-cpp-precomp

post-destroot {
    fs-traverse file ${destroot}${prefix}/lib/perl5 {
        if {[file tail ${file}] == "perllocal.pod"} {
            delete ${file}
        }
    }
}

post-activate {
    system "dbus-uuidgen --ensure"
}

variant no_x11 {
    configure.args-append   --without-x
}

variant quartz requires no_x11 {
    patchfiles-append       gtkdocklet-quartz.diff

    configure.args-append   --disable-gestures \
                            --enable-gtkstatusicon

    depends_build           port:autoconf \
                            port:automake \
                            port:intltool

    post-patch {
        system "cd ${worksrcpath} && ${filespath}/autogen.sh"
    }
}

variant spellcheck description {Allow spell checking} {
    depends_lib-append      port:gtkspell2
    configure.args-delete   --disable-gtkspell
}

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/pidgin/files/
livecheck.regex     {/pidgin-([0-9.]+)\.tar}
