# -*- 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 114476 2013-12-09 15:39:01Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        engla keybinder 0.3.0 v
revision            1
categories          gnome devel
platforms           darwin
maintainers         ryandesign openmaintainer
license             GPL-2+

description         library for global keyboard shortcuts in GTK applications

long_description    ${name} is a library for registering global keyboard \
                    shortcuts in GTK-based applications using the X Window \
                    System.

master_sites        http://kaizer.se/publicfiles/keybinder/

checksums           rmd160  2f2e25860fa116f7872bbdb2850b75e3e43958cf \
                    sha256  42863ca0174d568a8c02c6fb243fee1681823825e8bcb1718c51611d8e9793bb

depends_build       port:pkgconfig

depends_lib         port:gtk2 \
                    port:gobject-introspection

patchfiles          patch_python-keybinder_Makefile.in.diff

configure.args      --disable-silent-rules \
                    --disable-gtk-doc \
                    --disable-lua

if {${name} eq ${subport}} {
    configure.args-append       --disable-python

    # gobject-introspection uses $CC from env
    build.args-append           CC="${configure.cc} ${configure.cc_archflags}"
}

set python.versions {26 27}

foreach v ${python.versions} {
    set python.version  ${v}
    set python.branch   [string range ${python.version} 0 end-1].[string index ${python.version} end]
    set python.bin      ${prefix}/bin/python${python.branch}
    set python.prefix   ${frameworks_dir}/Python.framework/Versions/${python.branch}

    subport py${python.version}-keybinder {
        depends_lib-append      port:${name} \
                                port:python${python.version} \
                                port:py${python.version}-pygtk

        configure.args-append   --enable-python \
                                --disable-introspection \
                                ac_cv_path_PYGTK_CODEGEN=${prefix}/bin/pygtk-codegen-2.0-${python.branch}

        configure.python        ${python.bin}
        configure.pkg_config_path   ${python.prefix}/lib/pkgconfig

        build.dir               ${worksrcpath}/python-keybinder
    }
}

# The rules enabled by gobject-introspection require GNU make 3.81+
platform darwin 8 {
    depends_build-append    port:gmake
    build.cmd               ${prefix}/bin/gmake
}
