# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-off    set: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 65907 2010-04-02 22:08:22Z jmr@macports.org $

PortSystem          1.0

name                gajim-devel
version             0.12-alpha1-r10268
homepage            http://www.gajim.org/
categories          net chat

description         A full featured and easy to use Jabber client.
long_description    The goal of Gajim is to provide a full featured and \
                    easy to use Jabber client. Gajim works nicely with \
                    GNOME, but does not require it to run.

maintainers         rene

platforms           darwin

fetch.type          svn
svn.url             svn://svn.gajim.org/gajim/trunk
svn.revision        10268
worksrcdir          trunk

patchfiles          patch-src-osx-Makefile.am.diff \
                    patch-src-osx-growl-Makefile.am.diff \
                    patch-src-osx-syncmenu-Makefile.am.diff \
                    patch-setup_osx.py.diff

depends_build       port:intltool \
                    port:py25-distribute \
                    port:py25-macholib-devel \
                    port:py25-py2app-devel

depends_lib         port:gettext \
                    port:gtk2 \
                    port:py25-gtk \
                    port:py25-gobject \
                    port:py25-docutils \
                    port:py25-openssl \
                    port:Growl

post-patch {
    set oldgtkpath "/Library/Frameworks/GTK+.framework/Versions/Current"
    reinplace "s|@PYTHON@|${prefix}/bin/python2.5|" \
        ${worksrcpath}/scripts/gajim-remote.in
    reinplace "s|@PYTHON@|${prefix}/bin/python2.5|" \
        ${worksrcpath}/scripts/gajim.in
    reinplace "s|${oldgtkpath}|${prefix}|" \
        ${worksrcpath}/src/osx/syncmenu/Makefile.am
    reinplace "s|${oldgtkpath}|${prefix}|" \
        ${worksrcpath}/setup_osx.py
}

pre-configure {
    set aclocal "${prefix}/bin/aclocal"
    system "cd ${worksrcpath} && ${aclocal} -I m4/ -I ${prefix}/share/aclocal/"
    system "cd ${worksrcpath} && ./autogen.sh"
}

use_autoconf        yes
use_automake        yes
automake.args       --foreign --add-missing --copy

configure.args      --disable-dependency-tracking \
                    --with-x \
                    --disable-remote \
                    CC=gcc CPP=cpp CXX=g++

destroot {
    system "cd ${worksrcpath} && ${prefix}/bin/python2.5 setup_osx.py build"
    xinstall -d ${destroot}${applications_dir}
    file rename ${worksrcpath}/dist/Gajim.app \
        ${destroot}${applications_dir}/
    ui_msg "********************************************************"
    ui_msg "* Gajim has been installed to ${applications_dir}"
    ui_msg "* Double click Gajim.app to start using it."
    ui_msg "********************************************************"
}

variant no_x11 description {Disable X11 support} {
    configure.args-delete   --with-x
}

variant dbus description {Enable dbus support} {
    depends_lib-append      port:dbus-python25
}

variant remote description {Enable remote support} {
    configure.args-delete   --disable-remote
    configure.args-append   --enable-remote
}

