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

name            py27-pygtksourceview
version         2.10.1
revision        4
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      python x11
license         LGPL
platforms       darwin
maintainers     nomaintainer
description     Python bindings for GtkSourceView2
long_description ${description}

homepage        https://www.gnome.org/
master_sites    gnome:sources/pygtksourceview/${branch}/
distname        pygtksourceview-${version}

checksums       rmd160  867b6986beec48538bf4aa8af8a566578d16085c \
                sha256  2ae9356b0b189e7ebf61e366152aac0a471b17b4ddead5bf747bf4c912a0d698 \
                size    368703

# macOS 11 libtool bug
patchfiles-append pygtksourceview-libtool-bug.diff

depends_build   port:pkgconfig \
                port:libxslt \
                port:docbook-xsl-nons

depends_lib     port:py27-gobject \
                port:py27-pygtk \
                port:gtksourceview2

configure.python    ${prefix}/bin/python2.7
set python_prefix   ${frameworks_dir}/Python.framework/Versions/2.7
configure.pre_args  --prefix=${python_prefix}
configure.args      --includedir=${python_prefix}/include/python2.7
configure.pkg_config_path  ${python_prefix}/lib/pkgconfig:${prefix}/lib/pkgconfig

platform darwin 9 {
    post-patch {
        reinplace "s| -export-symbols-regex.*||g" ${worksrcpath}/Makefile.in
    }
}

# install text docs in ${prefix}/share/doc/${name}
# add link to gtk-doc in devhelp search path (${prefix}/share/gtk-doc/html/*)
# devhelp requires gtk-doc/html directory name  and .devhelp file name (less the .devhelp) to match

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README \
         ${destroot}${docdir}
    xinstall -d ${destroot}${prefix}/share/gtk-doc/html
    file rename ${destroot}${python_prefix}/share/gtk-doc/html/pygtksourceview2/pygtksourceview2.devhelp \
                ${destroot}${python_prefix}/share/gtk-doc/html/pygtksourceview2/${name}.devhelp
    ln -s ${python_prefix}/share/gtk-doc/html/pygtksourceview2 \
          ${destroot}${prefix}/share/gtk-doc/html/${name}
}

livecheck.type  gnome
livecheck.name  pygtksourceview
