# -*- 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 119766 2014-05-06 04:23:48Z devans@macports.org $

PortSystem      1.0
PortGroup       active_variants 1.1

name            gnome-settings-daemon
version         3.12.2
license         GPL-2 LGPL-2.1
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Gnome 3 settings daemon.
long_description ${description}
maintainers     devans openmaintainer
categories      gnome
platforms       darwin
homepage        http://www.gnome.org/
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  cd905f4c5a109835c832e8c4abf0f115d2b3faf2 \
                sha256  e887bd63c733febccb7f2c1453c075016342e223214fa9cfc60d90f1e16e080f

depends_build   port:pkgconfig \
                port:intltool \
                port:docbook-xsl \
                port:docbook-xml

depends_lib     port:gtk3 \
                port:gsettings-desktop-schemas \
                port:gnome-desktop \
                port:lcms2 \
                port:libnotify \
                port:fontconfig \
                port:geocode-glib \
                port:geoclue2 \
                port:libcanberra \
                port:libgweather \
                port:pulseaudio \
                port:upower \
                port:xorg-kbproto \
                port:xorg-libXi \
                port:xorg-libXtst \
                port:xorg-libXfixes \
                port:xorg-libXrandr \
                port:xorg-libxkbfile

# Without libcanberra +x11 gnome-settings-daemon will fail to find the libcanberra-gtk3 package, aborting configure
require_active_variants port:libcanberra x11

#
# the following plugins are disabled by patch
#
# color (requires colord)
# power (requires X server support for Xtst extension and segfaults when it doesn't find it)
# xrandr (works but tries to take over control of display causing problems with Mac OS X)
#

pre-patch {
    copy ${worksrcpath}/plugins/Makefile.am ${worksrcpath}/plugins/Makefile.am.orig
}

patchfiles      patch-plugins.diff

use_autoreconf  yes
autoreconf.args -fvi

configure.args  --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
                --disable-gudev \
                --disable-ibus \
                --disable-smartcard-support \
                --disable-rfkill \
                --disable-maintainer-mode \
                --disable-silent-rules

platform darwin {
    if {${os.major} < 10} {
        configure.args-append --disable-cups
    }
}

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

livecheck.type  gnome
