# -*- 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
PortGroup           gobject_introspection 1.0

name                gtksourceview3
set gname           gtksourceview
version             3.24.11
revision            1
license             LGPL-2.1+
set branch          [join [lrange [split ${version} .] 0 1] .]
maintainers         {devans @dbevans} openmaintainer
categories          gnome
description         GtkSourceView-3.0 is a source highlighting text widget for GTK+ 3

long_description    GtkSourceView is a text widget that extends the standard \
                    GTK+ 3.x text widget GtkTextView. It improves GtkTextView \
                    by implementing syntax highlighting and other features \
                    typical of a source editor. This port contains version 3 of the \
                    GtkSourceView widget. Port GtkSourceView2 contains version 2 of the \
                    widget and port GtkSourceview contains version 1.

homepage            https://wiki.gnome.org/Projects/GtkSourceView
master_sites        gnome:sources/${gname}/${branch}/
distname            ${gname}-${version}
use_xz              yes

checksums           rmd160  34e86ab283b39f2778d5091a8595f5440598eb62 \
                    sha256  691b074a37b2a307f7f48edc5b8c7afa7301709be56378ccf9cc9735909077fd \
                    size    1438232

set port_ver_major  [lindex [split ${version} .] 0]

depends_build       port:gettext \
                    port:gtk-doc \
                    port:pkgconfig \
                    path:bin/vala:vala

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gettext-runtime \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:libxml2

gobject_introspection yes

# requires compiler that supports C11 (redefinition of typedef ‘GtkSourceTag’ at gtksourceview/gtksourcetag.h:35)
compiler.c_standard 2011

# use autoreconf to heal broken configure file
# error: Something went wrong bootstrapping makefile fragments
use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --enable-compile-warnings=no \
                    --disable-silent-rules

test.run            yes
test.dir            ${worksrcpath}/testsuite
test.target         check

variant glade description {Install a glade catalog file} {
    configure.args-append   --enable-glade-catalog
    depends_lib-append      port:glade
}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING MAINTAINERS \
        NEWS README ${destroot}${docdir}

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

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

livecheck.type      gnome
livecheck.name      ${gname}
livecheck.regex     "LATEST-IS-(${port_ver_major}\\.\\d*\[02468\](?:\\.\\d+)*)"
