# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem      1.0

name            gnome-sharp2
set my_name     gnome-sharp
version         2.20.0
revision        1
categories      gnome devel
platforms       darwin
maintainers     nox openmaintainer
description     Gtk bindings for the Mono .NET Development Framework

long_description \
    This is the Gtk# toolkit for Mono, an implementation \
	of the .NET Development Framework.

homepage        http://gtk-sharp.sourceforge.net/
master_sites    http://go-mono.com/sources/${name}/
distname        ${my_name}-${version}

checksums       md5     1cdb85652a6504afe6fad569daa901ee \
                sha1    4a142ec30195828f57f3f294d1d279843355d531 \
                rmd160  33249f3af171161f1aa79d62987ee905febe7391

use_bzip2       yes

patchfiles      patch-gnome-sharp.dll.config.in.diff \
                patch-disable-schemas-installation.diff

depends_lib     port:mono \
                path:lib/pkgconfig/glib-2.0.pc:glib2 \
                port:gtk2 \
                port:libart_lgpl \
                port:gnome-vfs \
                port:libgnomecanvas \
                port:libgnomeui \
                port:libgnomeprintui \
                port:gnome-panel \
                port:gtk-sharp2

post-configure {
    # TODO This shouldn't be needed, we need to fix Mono dllmap library path.
    fs-traverse {f} ${worksrcpath} {
        if {[string match *.dll.config ${f}]} {
            reinplace -E "s|(target=\")|\\1${prefix}/lib/|" ${f}
        }
    }

    reinplace "s/libgtk-x11-2\\.0\\.0\\.dylib/[glob -tail -path $prefix/lib/ libgtk-*-2.0.0.dylib]/" \
        $worksrcpath/gnome/gnome-sharp.dll.config
}

variant no_x11 {
    pre-fetch {
        if {[file exists ${prefix}/lib/pkgconfig/gtk+-x11-2.0.pc]} {
            ui_error "Please uninstall or deactivate the gtk2 port and reinstall it by running `port install gtk2 +no_x11`."
            error "gtk2 must be installed with the no_x11 variant enabled."
        }
    }

    patchfiles-append   patch-disable-gnomepanel.diff
    depends_lib-delete  port:gnome-panel
}

livecheck.type  regex
livecheck.url   http://go-mono.com/sources-stable/
livecheck.regex ${my_name}-(\\d+(?:\\.\\d+)*)
