# -*- 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 107979 2013-07-10 03:51:51Z devans@macports.org $

PortSystem      1.0

name            gnome-menus
version         2.30.5
revision        3
set branch      [join [lrange [split ${version} .] 0 1] .]
maintainers     devans openmaintainer
categories      gnome
license         LGPL-2+
platforms       darwin
description     Menu component for the GNOME 2 Desktop.

long_description \
    ${description}

homepage        http://www.gnome.org/
master_sites    gnome:sources/${name}/${branch}/
use_bzip2       yes

checksums       md5     caa6772e63ed5870cf43dc3d354e0624 \
                sha1    dcf7af8507d5678d6bb1bf705d2c4ac2238c6da5 \
                rmd160  f3fafb467a7d9aaf0168236dab46f8bf82f71c26

patchfiles      patch-configure.diff

depends_build   port:pkgconfig \
                port:intltool \
                port:gnome-doc-utils \
                port:gobject-introspection

depends_lib     port:desktop-file-utils \
                path:lib/pkgconfig/glib-2.0.pc:glib2

variant python25 conflicts python26 python27 description {Use python 2.5} {
    configure.python          ${prefix}/bin/python2.5
    depends_lib-append        port:py25-pygtk
}

variant python26 conflicts python25 python27 description {Use python 2.6} {
    configure.python          ${prefix}/bin/python2.6
    depends_lib-append        port:py26-pygtk
}

variant python27 conflicts python25 python26 description {Use python 2.7} {
    configure.python          ${prefix}/bin/python2.7
    depends_lib-append        port:py27-pygtk
}

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

post-patch {
    reinplace "s|/usr/bin/env python|${configure.python}|g" \
        ${worksrcpath}/simple-editor/gmenu-simple-editor.in \
        ${worksrcpath}/simple-editor/GMenuSimpleEditor/config.py.in \
        ${worksrcpath}/simple-editor/GMenuSimpleEditor/main.py \
        ${worksrcpath}/simple-editor/GMenuSimpleEditor/maindialog.py \
        ${worksrcpath}/simple-editor/GMenuSimpleEditor/menufilewriter.py \
        ${worksrcpath}/simple-editor/GMenuSimpleEditor/menutreemodel.py
}

configure.args  --enable-introspection \
                --enable-python \
                --disable-silent-rules

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

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

post-activate {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
}

livecheck.type  gnome
