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

name                py-poppler-qt5
python.rootname     python-poppler-qt5
version             0.75.0
platforms           darwin
license             LGPL-2.1+
maintainers         {gmail.com:davide.liessi @dliessi} openmaintainer

description         Python binding for Poppler-Qt5
long_description    ${python.rootname} is a Python binding for Poppler-Qt5 \
                    that aims for completeness \
                    and for being actively maintained. \
                    Using this module you can access \
                    the contents of PDF files \
                    inside PyQt5 applications.

homepage            https://github.com/wbsoft/${python.rootname}

checksums           md5     e411d6c8bb25faa9208387b1075895ad \
                    rmd160  ac42b3a4fbcd63e79fbfa42537f75087f06b170b \
                    sha256  ea0ec9ebe995705ab19a301290365652e62bab5c9b05db5697c7bf2173335107 \
                    size    23608

python.versions     27 35 36 37 38 39

compiler.cxx_standard   2011

if {${name} ne ${subport}} {
    depends_build-append    port:py${python.version}-setuptools

    depends_lib-append      port:poppler-qt5 \
                            port:py${python.version}-sip \
                            port:py${python.version}-pyqt5

    patchfiles              patch-fix-qt-dirs.diff

    post-patch {
        reinplace "s|%%QMAKE%%|${qt_qmake_cmd}|g" ${worksrcpath}/setup.py
    }

    post-destroot {
        set doc_dir ${destroot}${prefix}/share/doc/${subport}
        xinstall -d ${doc_dir}
        xinstall -m 644 -W ${worksrcpath} \
            ChangeLog \
            LICENSE \
            README.rst \
            ${doc_dir}
        set examples_dir ${destroot}${prefix}/share/examples/${subport}
        xinstall -d ${examples_dir}
        xinstall -m 644 -W ${worksrcpath} demo.py ${examples_dir}
    }

    livecheck.type  none
}
