# -*- 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 85721 2011-10-16 03:56:38Z dports@macports.org $

PortSystem      1.0

name            py27-pygtksourceview
version         2.10.1
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        http://www.gnome.org/
master_sites    gnome:sources/pygtksourceview/${branch}/
distname        pygtksourceview-${version}

checksums       md5     7a4dd87a515374637e1acf0b340eaa92 \
                sha1    fe4d3ce889427d5a5ae418415fc18f36b9b02524 \
                rmd160  867b6986beec48538bf4aa8af8a566578d16085c

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

depends_lib     port:py27-gobject \
                port:py27-gtk \
                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  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/pygtksourceview/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
