# -*- 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 119977 2014-05-12 15:06:39Z devans@macports.org $

PortSystem          1.0
PortGroup           active_variants 1.1

name                gtksourceview3
set gname           gtksourceview
version             3.12.2
license             LGPL-2.1+
set branch          [join [lrange [split ${version} .] 0 1] .]
maintainers         devans openmaintainer
categories          gnome
platforms           darwin
description         GtkSourceView-3.0 is a 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  0d00d3f7e4555164163a4aa7bc752d794650402e \
                    sha256  62a31eee00f633d7959efb7eec44049ebd0345d670265853dcd21c057f3f30ad

depends_build       port:intltool \
                    port:pkgconfig \
                    port:gnome-common \
                    port:gtk-doc

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gettext \
                    port:gtk3 \
                    port:gobject-introspection \
                    port:libxml2

# update m4/intltool.m4 and autoreconf

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

use_autoreconf      yes
autoreconf.args     -fvi

configure.args      --enable-compile-warnings=minimum \
                    --enable-introspection=yes \
                    --disable-silent-rules

test.run            yes
test.target         check

variant quartz {
    depends_lib-append  port:gtk-osx-application
}

if {[variant_isset quartz]} {
    require_active_variants gtk3 quartz
    require_active_variants gtk-osx-application gtk3
} else {
    require_active_variants gtk3 x11
}

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 COPYING.lib 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}
