# -*- 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 85730 2011-10-16 04:15:11Z dports@macports.org $

PortSystem 1.0

name		gnome-games
version		2.30.2
revision        2
set branch  [join [lrange [split ${version} .] 0 1] .]
description	Collection of small but addictive games for GNOME
long_description    ${description}
maintainers	devans openmaintainer
categories	gnome
license     GPL-3+
platforms	darwin
homepage        http://live.gnome.org/GnomeGames/
master_sites    gnome:sources/${name}/${branch}/

checksums       md5     1fc03fe2209aa8a70da8f25d6eae1735 \
                sha1    3541ccc991af82603fc3067863bc27a731302b2c \
                rmd160  12c7e5ba3b4a9aca5d9918978e437e774ac0752b

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

depends_lib     port:gconf \
                port:librsvg \
                port:clutter-gtk \
                port:libcanberra \
                port:xorg-libsm \
                port:guile
              
use_bzip2 	yes

patchfiles      patch-configure.diff

variant python25 conflicts python26 python27 description {Use python 2.5} {
    configure.python          ${prefix}/bin/python2.5
    depends_lib-append        port:py25-gtk
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.5
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
}

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

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

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

configure.args  --disable-scrollkeeper \
                --disable-schemas-install \
                --disable-silent-rules \
                --disable-introspection

#
# mesa does not support darwin 8 (Tiger) so omit games that use its dependent clutter-gtk
#

if { ${os.major} < 9 } {
    depends_lib-delete    port:clutter-gtk
    configure.args-append --enable-omitgames=quadrapassel,lightsoff,swell-foop,gnibbles
}

post-patch {
    reinplace "s|/usr/bin/env python|${configure.python}|" ${worksrcpath}/glchess/src/glchess.in.in
    reinplace "s|/usr/bin/env python|${configure.python}|" ${worksrcpath}/gnome-sudoku/src/gnome-sudoku.in.in
}

post-activate {
        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 "export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
            gconftool-2 --makefile-install-rule ${prefix}/etc/gconf/schemas/*.schemas"
}

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