# -*- 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 118361 2014-03-31 22:35:05Z devans@macports.org $

PortSystem      1.0

name            gnome-games
version         3.6.1
revision        1
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Collection of small but addictive games for GNOME
long_description ${description}
maintainers     nomaintainer
categories      gnome
license         GPL-3+
platforms       darwin
homepage        https://wiki.gnome.org/Apps/Games
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  04ea846939f5a9bba2c444efaaa650dbe031a397 \
                sha256  f016068350ca2a4deceeac0374d5372610b1da07e2c4b356470f3401e6e2a43d

depends_build   port:pkgconfig \
                port:intltool \
                port:gnome-common \
                port:yelp-tools \
                port:itstool \
                port:libxml2

depends_lib     port:desktop-file-utils \
                port:gtk3 \
                port:librsvg \
                port:libcanberra \
                port:xorg-libX11
              
depends_run     port:gnome-settings-daemon \
                port:yelp

patchfiles      patch-configure.ac.diff

# update m4/intltool.m4 and autoreconf

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

use_autoreconf  yes
autoreconf.args -fvi

configure.args  --enable-games="gnect,gnomine,gtali,gnotravex,gnotski,glines,iagno,gnobots2" \
                --disable-schemas-compile \
                --disable-silent-rules \

configure.cflags-append \
                -Wno-error=format-nonliteral

variant python26 conflicts python27 description {Use python 2.6} {
    configure.python          ${prefix}/bin/python2.6
    depends_lib-append        port:py26-pygtk
    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-pygtk
    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
}

post-activate {
    system "${prefix}/bin/update-desktop-database -q ${prefix}/share/applications"
    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
