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

PortSystem      1.0

name            glade
version         3.18.3
license         LGPL-2+ GPL-2+
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Glade is a RAD tool to enable quick & easy development of user interfaces \
                for the GTK+ 3.* toolkit and the GNOME desktop environment.
long_description ${description}
maintainers     devans openmaintainer
categories      devel gnome
platforms       darwin
homepage        https://wiki.gnome.org/Apps/Glade
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  2d7c58cb70534634174a9ea801e347887669eae6 \
                sha256  ecdbce46e7fbfecd463be840b94fbf54d83723b3ebe075414cfd225ddab66452

depends_skip_archcheck devhelp

depends_build   port:pkgconfig \
                port:intltool \
                port:itstool \
                port:gnome-common \
                port:yelp-tools \
                port:gtk-doc

depends_lib     port:gtk3 \
                port:gobject-introspection \
                port:libxml2

depends_run     port:desktop-file-utils \
                port:devhelp

# update m4/intltool.m4 and autoreconf

pre-configure {
    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
}

use_autoreconf      yes
autoreconf.args     -fvi

#
# disable optimization which (at least with clang)
# causes glade to segfault on startup
# after displaying main window
#

configure.optflags -O0

configure.args  --enable-introspection=yes \
                --enable-gladeui \
                --enable-debug \
                --disable-silent-rules

configure.cflags-append \
                -Wno-format-nonliteral

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

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

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

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
