# -*- 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

PortSystem          1.0
PortGroup           active_variants 1.1

name                glade3
version             3.8.6
revision            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+ 2.* toolkit and the GNOME desktop environment.
long_description    {*}${description}
maintainers         {devans @dbevans} openmaintainer
categories          devel gnome
homepage            https://wiki.gnome.org/Apps/Glade
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  169269ce403fdd538c803d6c73112770cd6731d2 \
                    sha256  aaeeebffaeb3068fb23757a2eede46adeb4c7cecc740feed7654e065491f5449 \
                    size    2315188

depends_skip_archcheck devhelp

depends_build       port:pkgconfig \
                    port:intltool \
                    port:gnome-common \
                    port:gnome-doc-utils \
                    port:gtk-doc \
                    port:yelp-tools \
                    port:itstool \
                    port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         port:desktop-file-utils \
                    path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                    port:libxml2

depends_run         port:devhelp

patchfiles-append   bg.po.patch \
                    hi.po.patch \
                    hi.po2.patch \
                    uk.po.patch

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility

configure.cmd       ./autogen.sh

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

configure.args      --disable-silent-rules \
                    --disable-gnome \
                    --disable-python

variant python27 description {Enable support for Python widgets using Python 2.7} {
    configure.args-replace    --disable-python --enable-python
    configure.python          ${prefix}/bin/python2.7
    depends_lib-append        port:py27-pygtk
    set python_framework      ${frameworks_dir}/Python.framework/Versions/2.7
    configure.pkg_config_path ${python_framework}/lib/pkgconfig
}

# currenlty, libbonoboui is broken if gtk2 was installed with +quartz (#48986)
variant gnome conflicts quartz description {Enable support for GNOME2 UI widgets} {
    configure.args-replace    --disable-gnome  --enable-gnome
    depends_lib-append        port:libbonoboui \
                              port:libgnomeui
}

variant quartz conflicts gnome {
    # configure script automatically detects if gtk2 was installed with quartz variant
    require_active_variants gtk2 quartz

    depends_lib-append port:gtk-osx-application-gtk2

    patchfiles-append \
        patch-quartz.diff
}

if {![variant_isset quartz]} {
    require_active_variants gtk2 x11
}

default_variants +python27
if {![variant_isset quartz]} {
    default_variants-append +gnome
}

notes "
To view the Glade Interface Designer Manual (GTK+ 2 version), use

% yelp help:glade3
"

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

livecheck.type      gnome
