# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 92497 2012-04-30 08:46:09Z jmr@macports.org $

PortSystem      1.0

name            py26-gtk
set my_name     pygtk
version         2.22.0
revision        1
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      python x11
platforms       darwin
license         LGPL-2.1+
maintainers     mcalhoun openmaintainer
description     PyGTK is the Python binding to GTK+ 2.x

long_description \
    PyGTK contains modules that allow you to use gtk in Python programs. \
    At present, it is a fairly complete set of bindings.

homepage        http://www.pygtk.org/
master_sites    gnome:sources/${my_name}/${branch}/
distname        ${my_name}-${version}
use_bzip2       yes

checksums       md5     e9bba9cd4cdaccb22a7991cc2f7c8373 \
                sha1    6a180d0c9ed19179662f51decb150b2c98cc9362 \
                rmd160  98fb89d32f36c97cc51bf4eb1aa38699bf010c8e

depends_build   port:pkgconfig
depends_lib     port:python26 \
                port:atk \
                port:gtk2 \
                port:libglade2 \
                port:py26-cairo \
                port:py26-gobject

set python_prefix ${frameworks_dir}/Python.framework/Versions/2.6

configure.pre_args-delete  --prefix=${prefix}
configure.pre_args-append  --prefix=${python_prefix}
configure.args-append      --includedir=${python_prefix}/include/python2.6
configure.pkg_config_path  ${python_prefix}/lib/pkgconfig

configure.python    ${prefix}/bin/python2.6

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

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
    system "ln -s ${python_prefix}/share/${my_name} ${destroot}${prefix}/share/${my_name}26"
# devhelp requires gtk-doc directory name  and .devhelp file name (less the .devhelp) to match
    file rename ${destroot}${python_prefix}/share/gtk-doc/html/${my_name}/${my_name}.devhelp \
                ${destroot}${python_prefix}/share/gtk-doc/html/${my_name}/${my_name}26.devhelp 
    system "ln -s ${python_prefix}/share/gtk-doc/html/${my_name} ${destroot}${prefix}/share/gtk-doc/html/${my_name}26"
}

livecheck.type  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/${my_name}/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
