# -*- 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 92239 2012-04-22 10:09:39Z jeremyhu@macports.org $

PortSystem 1.0

name		gnome-control-center
version		2.30.1
revision        1
set branch      [join [lrange [split ${version} .] 0 1] .]
description	Control center for GNOME 2.0 project.
long_description        ${description}
maintainers	devans openmaintainer
categories	gnome
license     GPL-2+
platforms	darwin
homepage	http://www.gnome.org/

master_sites    gnome:sources/${name}/${branch}/

checksums       md5     9608eae5605cfc478ba35b683bf129c1 \
                sha1    f7d3f486e114871e53f3d7e743d53b041ebf2f1e \
                rmd160  7323a59deb13a8017de4e9f6ee8499fad6b6d7aa

depends_lib	port:metacity \
	        port:nautilus \
	        port:gnome-panel \
	        port:gnome-settings-daemon \
                port:xorg-libXScrnSaver

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

if {${os.platform} == "darwin" && ${os.major} < 9} {
    patchfiles      patch-libslab-director-tile.c.diff
}

patchfiles-append glib-2.32.patch
use_autoreconf  yes
autoreconf.args -fvi

use_bzip2 	yes

configure.args	\
		--mandir=${prefix}/share/man \
		--x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib \
		--disable-scrollkeeper \
		--disable-update-mimedb \
		--disable-schemas-install

post-patch {
	reinplace  "s|/usr/share|${prefix}/share|g" \
		${worksrcpath}/capplets/common/gnome-theme-info.c \
		${worksrcpath}/libwindow-settings/metacity-window-manager.c
}

#
# port gnome-panel -> evolution-data-server -> nss is not universal
#

universal_variant no

post-destroot	{
	file delete ${destroot}${prefix}/etc/gconf/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas
	file delete ${destroot}${prefix}/share/applications/mimeinfo.cache
}

post-activate	{
		system " \
		export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`&&\
		gconftool-2 --makefile-install-rule \
			${prefix}/etc/gconf/schemas/*.schemas &&\
		gconftool-2 --direct --config-source=\$GCONF_CONFIG_SOURCE \
			--recursive-unset /schemas/apps/panel &&\
		gconftool-2 --direct --config-source \
			xml:readwrite:${prefix}/etc/gconf/gconf.xml.defaults \
			--load ${prefix}/etc/gconf/schemas/panel-default-setup.entries "
		system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
		system "${prefix}/bin/scrollkeeper-update; true"
		system "${prefix}/bin/update-desktop-database -q ${prefix}/share/applications; true"
		system "${prefix}/bin/update-mime-database ${prefix}/share/mime; true"
}

platform darwin {
	post-destroot {
		system "cd ${destroot}${prefix}/lib/window-manager-settings/ && \
			ln -s libmetacity.so libmetacity.dylib"
		system "cd ${destroot}${prefix}/lib && \
			ln -s libgnome-window-settings.1.0.0.dylib libgnome-window-settings.1.0.0.so"
	}
}

livecheck.type  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/${name}/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
