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

PortSystem      1.0

name            libgweather
version         3.12.2
set branch      [join [lrange [split ${version} .] 0 1] .]
maintainers     devans openmaintainer
categories      net gnome
license         GPL-2+ LGPL-2.1+
platforms       darwin
description     Library to accessing online weather informations.

long_description \
                libgweather is a library to access weather \
                information from online services for numerous \
                locations.

homepage        https://wiki.gnome.org/Projects/LibGWeather
master_sites    gnome:sources/${name}/${branch}/

use_xz          yes

checksums       rmd160  790bbcc82a89a09c03a473897a7222e864ae0c01 \
                sha256  54ef096350d7774ab1b3f23ed768246301cdcedfaa762a2c46920bf87fcc1c37

depends_build   port:pkgconfig \
                port:intltool \
                port:autoconf \
                port:automake \
                port:libtool \
                port:gnome-common \
                port:gtk-doc

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

# use autogen.sh from upstream git to update m4/intltool.m4 using intltoolize and autoreconf

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
    file delete -force ${worksrcpath}/m4
}

configure.cmd   ./autogen.sh

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

configure.args  --enable-introspection=yes \
                --enable-vala=yes \
                --enable-glade-catalog=no \
                --disable-schemas-compile \
                --disable-silent-rules \
                --disable-glibtest

variant glade description {Enable building of glade catalog items} {
    depends_lib-append  port:glade
    configure.args-replace --enable-glade-catalog=no --enable-glade-catalog=yes
}

# glade expects catalog modules and libraries to have a .so suffix

post-destroot {
    if {[variant_isset glade]} {
        set libdir ${prefix}/lib
        ln -s ${libdir}/libgweather-3.dylib ${destroot}${libdir}/libgweather-3.so
    }
}

post-activate {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type  gnome
