# -*- 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 108019 2013-07-10 20:12:05Z cal@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-gobject3
set my_name         pygobject
version             3.8.3
set branch          [join [lrange [split ${version} .] 0 1] .]
categories-append   gnome
license             LGPL-2.1+
maintainers         cal openmaintainer
platforms           darwin
description         Python bindings for GObject, version 3

long_description \
    PyGObject is a Python dynamic module that enables developers to use the \
    power of GObject, which is part of the GNOME platform.

homepage            https://live.gnome.org/PyGObject
master_sites        gnome:sources/${my_name}/${branch}/
distname            ${my_name}-${version}
use_xz              yes

checksums           sha256  384b3e1b8d1e7c8796d7eb955380d62946dd0ed9c54ecf0817af2d6b254e082c \
                    rmd160  6cdf2a0d4b3a8856c7f8bf306b7dcf2e15fec7ca

python.versions     26 27 31 32 33

if {$subport != $name} {
    depends_build-append    port:pkgconfig
    depends_lib-append      path:lib/pkgconfig/glib-2.0.pc:glib2 \
                            port:libffi \
                            port:py${python.version}-cairo \
                            port:gobject-introspection

    use_configure           yes
    configure.python        ${python.bin}
    configure.env-append    PKG_CONFIG_PATH='${python.prefix}/lib/pkgconfig'
    configure.pre_args      --prefix='${python.prefix}'
    configure.args          --disable-glibtest
    configure.cppflags-append \
                            -I${python.prefix}/include

    build.cmd               [portbuild::build_getmaketype]
    build.target

    destroot.cmd            ${build.cmd}
    destroot.target         install
    destroot.destdir        DESTDIR=${destroot}

    test.run                yes
    test.env                PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
    test.target             check

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} \
            AUTHORS COPYING ChangeLog NEWS README \
            ${destroot}${docdir}
    }

    livecheck.type  none
} else {
    livecheck.type  gnome
    livecheck.name  ${my_name}
}
