# -*- 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 119006 2014-04-15 03:36:22Z devans@macports.org $

PortSystem      1.0

name            alacarte
version         3.11.91
epoch           1
license         GPL-2+
set branch      [join [lrange [split ${version} .] 0 1] .]
description     A simple freedesktop.org compliant menu editor for use with GNOME

long_description \
                ${description}

maintainers     devans openmaintainer
categories      gnome
platforms       darwin
homepage        http://www.gnome.org/
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  234571ead2b7cce827645f75af7b699ff742b8c2 \
                sha256  d77294f25ac9e4f293530080578d83dc8e014d5b7c6c01d6f9a7f1715719a384

supported_archs noarch

depends_build   port:pkgconfig \
                port:intltool \
                port:gtk-doc \
                port:libxslt

depends_lib     port:desktop-file-utils \
                port:gtk3 \
                port:gnome-menus

depends_run     port:gnome-settings-daemon \
                port:yelp

patchfiles      patch-Makefile.am.diff \
                patch-configure.ac.diff \
                patch-acinclude.m4.diff \
                patch-Alacarte-MenuEditor.py.diff

# reconfigure with our intltool.m4

use_autoreconf  yes
autoreconf.args -fvi

configure.args  --disable-silent-rules

post-destroot {
    move ${destroot}${prefix}/bin/alacarte.py ${destroot}${prefix}/bin/alacarte
}

# python3 is not supported

variant python26 description {Use python 2.6} {
    depends_lib-append          port:py26-gobject3
    configure.python            ${prefix}/bin/python2.6
    set python_prefix           ${frameworks_dir}/Python.framework/Versions/2.6
    configure.pkg_config_path   ${python_prefix}/lib/pkgconfig
}

variant python27 description {Use python 2.7} {
    depends_lib-append          port:py27-gobject3
    configure.python            ${prefix}/bin/python2.7
    set python_prefix           ${frameworks_dir}/Python.framework/Versions/2.7
    configure.pkg_config_path   ${python_prefix}/lib/pkgconfig
}

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

notes "
    Be sure to set the following environment variables:

        export XDG_DATA_DIRS=${prefix}/share
        export XDG_CONFIG_DIRS=${prefix}/etc/xdg
        export XDG_MENU_PREFIX=gnome-

    Alacarte needs them to find installed applications and menus to edit.
"

post-activate {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
}

livecheck.type  gnome-with-unstable
