# -*- 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
PortGroup           python 1.0

name                py-poppler
set rname           pypoppler
version             0.12.1
revision            6

license             GPL-2
maintainers         nomaintainer
description         Python bindings to the Poppler library
long_description    Python bindings for the Poppler PDF rendering library (libpoppler-glib).
python.versions     27

checksums           md5 1a89e5ed3042afc81bbd4d02e0cf640a \
                    rmd160 d6c196d6bbbaa9ef96c2ea3a38eb6a89308bab15 \
                    sha256 322f183d24798a056f3005d1ab8e3ac27d8cfbbf0982725b323bbfec1bab5355

homepage            https://launchpad.net/poppler-python
master_sites        ${homepage}/trunk/development/+download/
distname            ${rname}-${version}

# merged patch from gentoo launchpad repo to fix build with poppler 0.39
# https://trac.macports.org/ticket/50192
# https://bugs.launchpad.net/poppler-python/+bug/1528489

patchfiles          patch-poppler.defs.diff \
                    patch-poppler.override.diff \
                    dynamic_lookup-11.patch

if {${name} ne ${subport}} {
    depends_build-append \
                        port:pkgconfig
    depends_lib-append  port:atk \
                        path:lib/pkgconfig/poppler.pc:poppler \
                        port:py${python.version}-pygtk

    use_configure       yes
    configure.cmd       ./configure
    configure.pkg_config_path \
        ${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${python.prefix}/lib/pkgconfig/
    configure.pre_args  --prefix=${python.prefix}

    build.cmd           make
    build.target        all

    use_parallel_build  no

    destroot.cmd        make
    destroot.destdir    DESTDIR=${destroot}

    livecheck.type      none
}
livecheck.type      regex
livecheck.url       https://launchpad.net/poppler-python/trunk/development/
livecheck.regex     "${rname}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
