# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 108079 2013-07-12 18:51:43Z devans@macports.org $

PortSystem 1.0

name            empathy
version         2.34.0
license         {GPL-2 GFDL-1.3 Attribution-ShareAlike-3}
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Empathy is an instant-messaging(chat) program for GNOME
long_description \
                Empathy is an instant-messaging(chat) program which supports text, \
                voice, video, file transfers, and inter-application communication (tubes) \
                over many different protocols(AIM, MSN, Google/Jabber, Facebook, SIP, Yahoo, etc).
maintainers     devans openmaintainer
categories      gnome
platforms       darwin
homepage        http://live.gnome.org/Empathy
master_sites    gnome:sources/${name}/${branch}/

use_bzip2       yes

checksums       rmd160  a76e9633d88dbd48c5d494d3393566a88a5b35c4 \
                sha256  6efa0ae3ac3580ac9600f889c92497f36983e22da79d547a65030a14691369d1

depends_build   port:pkgconfig \
                port:intltool \
                port:gnome-doc-utils \
                port:gtk-doc

depends_lib     port:desktop-file-utils \
                port:gconf \
                port:dbus-glib \
                port:farsight2 \
                port:folks \
                port:gnome-keyring \
                port:libgnome-keyring \
                port:gnutls \
                port:gstreamer010 \
                port:gstreamer010-gst-plugins-base \
                port:libxml2 \
                port:telepathy-glib \
                port:telepathy-farsight \
                port:telepathy-logger \
                port:enchant \
                port:icu \
                port:iso-codes \
                port:jpeg \
                port:libcanberra \
                port:libnotify \
                port:libunique

depends_run     port:telepathy-mission-control \
                port:telepathy-gabble \
                port:telepathy-haze \
                port:telepathy-salut \
                port:gnome-settings-daemon \
                port:yelp

patchfiles      patch-configure.diff \
                patch-libnotify-api-0.5.1.diff

configure.args  --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                --enable-spell=yes \
                --enable-webkit=no \
                --enable-map=no \
                --enable-location=no \
                --enable-nautilus-sendto=no \
                --enable-control-center-embedding=no \
                --enable-call=no \
                --enable-debug \
                --with-connectivity=no \
                --without-ca-file \
                --without-eds \
                --disable-coding-style-checks \
                --disable-Werror \
                --disable-silent-rules \
                --disable-scrollkeeper \
                --disable-schemas-compile

post-destroot {
    set gsettingsschemadir ${prefix}/share/glib-2.0/schemas
    file mkdir ${destroot}${gsettingsschemadir}
    file copy [glob ${worksrcpath}/data/*.gschema.xml] ${destroot}${gsettingsschemadir}
}

#
# enable build on Tiger by disabling map
# support which indirectly depends on mesa
# see #24393.
#

if {${os.major} > 8 && ${os.platform} == "darwin"} {
    variant map description {Enable maps using libchamplain} {
        depends_lib-append  port:libchamplain
        configure.args-replace  --enable-map=no --enable-map=yes
    }
}

variant location description {Enable location awareness using geoclue} {
    depends_lib-append      port:geoclue
    configure.args-replace  --enable-location=no --enable-location=yes
}

variant webkit description {Enable support Adium themes using webkit} {
    depends_lib-append      port:webkit-gtk
    configure.args-replace  --enable-webkit=no --enable-webkit=yes
}

variant eds description {Enable E-D-S support with telepathy-salut} {
    depends_lib-append      port:evolution-data-server
    configure.args-replace  --without-eds --with-eds
}

#
# telepathy-haze -> pidgin is not universal
#

universal_variant no

variant python26 conflicts python27 description {Build using Python 2.6} {
    configure.python          ${prefix}/bin/python2.6
    depends_build-append      port:python26
}

variant python27 conflicts python26 description {Build using Python 2.7} {
    configure.python          ${prefix}/bin/python2.7
    depends_build-append      port:python27
}

if {![variant_isset python26]} {
    default_variants +python27
}

post-activate {
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type  gnome
