# -*- 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 72670 2010-10-23 08:42:35Z elelay@macports.org $

PortSystem 1.0

name            gtk-osx-application
version         0.9.6
categories      devel
maintainers     elelay openmaintainer

description	Mac OS X menu bar integration library for GTK2 quartz

long_description \
		A simple library whose purpose is to \
		allow GTK2 quartz applications to integrate with \
		the Mac OS X menu bar. Requires gtk2 and its \
                dependencies to be built with variants +no_x11 +quartz

homepage        http://live.gnome.org/GTK%2B/OSX/Integration
platforms       darwin

master_sites	http://sourceforge.net/projects/gtk-osx/files/GTK-OSX%20Build/
distname	    ige-mac-integration-${version}
use_bzip2       yes

checksums           md5     f9783c2a93d330b4546243abe1386298 \
                    sha1    07f76d449312baa14376aa24fc56ff216616c211 \
                    rmd160  c2f5400c746d600367415d272ee68cc6a366dd20

depends_build   port:pkgconfig

pre-configure {
    if {![file exists ${prefix}/lib/pkgconfig/gdk-quartz-2.0.pc]} {
        ui_error "

****
**** gtk-osx-application is meant to be used only in a GTK2 quartz
**** development environment but your version of GTK2 does not
**** support quartz.  Please make sure that port gtk2 and all its
**** dependencies are built with variants +no_x11 +quartz and try again.
****
"
        error "gtk2 +no_x11 +quartz not installed."
    }
}

variant python25 conflicts python26 description {Use Python 2.5} {
    depends_lib-append port:py25-gtk
    set python_prefix 	        ${frameworks_dir}/Python.framework/Versions/2.5
        
    configure.python 	        ${python_prefix}/bin/python2.5
    configure.env-append 	    PYGTK_CODEGEN=${python_prefix}/bin/pygtk-codegen-2.0
    configure.env-append 	    PYGOBJECT_CODEGEN=${python_prefix}/bin/pygobject-codegen-2.0
    configure.pkg_config_path   ${python_prefix}/lib/pkgconfig/
    configure.pre_args	        --prefix=${python_prefix}
}

variant python26 conflicts python25 description {Use Python 2.6} {
    depends_lib-append port:py26-gtk
    set python_prefix 	        ${frameworks_dir}/Python.framework/Versions/2.6
        
    configure.python 	        ${python_prefix}/bin/python2.6
    configure.env-append 	    PYGTK_CODEGEN=${python_prefix}/bin/pygtk-codegen-2.0
    configure.env-append 	    PYGOBJECT_CODEGEN=${python_prefix}/bin/pygobject-codegen-2.0
    configure.pkg_config_path   ${python_prefix}/lib/pkgconfig/
    configure.pre_args	        --prefix=${python_prefix}
}

variant python27 conflicts python26 conflicts python25 description {Use Python 2.7} {
    depends_lib-append port:py27-gtk
    set python_prefix           ${frameworks_dir}/Python.framework/Versions/2.7

    configure.python            ${python_prefix}/bin/python2.7
    configure.env-append        PYGTK_CODEGEN=${python_prefix}/bin/pygtk-codegen-2.0
    configure.env-append        PYGOBJECT_CODEGEN=${python_prefix}/bin/pygobject-codegen-2.0
    configure.pkg_config_path   ${python_prefix}/lib/pkgconfig/
    configure.pre_args          --prefix=${python_prefix}
}

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


configure.ccache	no
configure.cmd-append    --libdir=${prefix}/lib --includedir=${prefix}/include

# patch-src-gtkosxapplication_quartz-c.diff is a temporary patch for 0.9.6
# see https://sourceforge.net/apps/trac/gtk-osx/ticket/41
patchfiles-append       patch-bindings-python-gtk_osxapplication-Makefile-in.diff\
                        patch-bindings-python-igemacintegration-Makefile-in.diff\
                        patch-src-gtkosxapplication_quartz-c.diff
