# -*- 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 119533 2014-04-29 16:31:59Z devans@macports.org $

PortSystem      1.0

name            gnome-applets
version         3.5.92
revision        2
set branch      [join [lrange [split ${version} .] 0 1] .]
description     GNOME panel applets.
long_description This package contains applets for use with the \
                GNOME panel.
maintainers     devans openmaintainer
categories      gnome
license         GPL-2+
platforms       darwin
homepage        https://wiki.gnome.org/Projects/GnomeApplets
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  aff6f3b134e5ddac18d7bc7f7bc1255645ac87fb \
                sha256  f6178cb702a39a4103fcb97e9a266bf6d05f05ac5064818f119c023d76170e83

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

depends_lib     port:gnome-icon-theme \
                port:gtk3 \
                port:gconf \
                port:gnome-panel \
                port:libgtop \
                port:gnome-settings-daemon \
                port:libwnck3 \
                port:libnotify \
                port:policykit \
                port:gucharmap \
                port:libxml2 \
                port:rarian

patchfiles      patch-configure.in.diff

configure.cflags-append \
                -Wno-format-nonliteral \
                -Wno-missing-prototypes

post-patch {
    reinplace "s|/usr/bin/env python|${configure.python}|" \
        ${worksrcpath}/invest-applet/invest/chart.py \
        ${worksrcpath}/invest-applet/invest/invest-applet.py \
        ${worksrcpath}/invest-applet/invest/invest-chart \
        ${worksrcpath}/invest-applet/invest/test.py
}

# update m4/intltool.m4 and autoreconf

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf  yes
autoreconf.args -fvi

variant python26 conflicts python27 description {Use python 2.6} {
    configure.python          ${prefix}/bin/python2.6
    depends_lib-append        port:py26-gobject
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.6
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
}

variant python27 conflicts python26 description {Use python 2.7} {
    configure.python          ${prefix}/bin/python2.7
    depends_lib-append        port:py27-gobject
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.7
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
}

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

configure.args  --without-hal \
                --disable-networkmanager \
                --disable-mixer-applet \
                --disable-battstat \
                --disable-cpufreq \
                --disable-frequency-selector \
                --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                --disable-scrollkeeper \
                --disable-schemas-install \
                --disable-silent-rules

post-activate {
   system "scrollkeeper-update"
   system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
   system "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
        gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
}

livecheck.type  gnome-with-unstable
