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

name                py-mupdf

# Keep synchronized with port:mupdf.
github.setup        pymupdf PyMuPDF 1.24.2
github.tarball_from archive

revision            0
categories          python graphics
maintainers         nomaintainer
license             AGPL-3+

description         Python bindings for MuPDF, a lightweight PDF, XPS, \
                    and E-book viewer, renderer and toolkit
long_description    PyMuPDF adds Python bindings and abstractions to MuPDF, \
                    a lightweight PDF, XPS, and eBook viewer, renderer \
                    and toolkit. Both PyMuPDF and MuPDF are maintained \
                    and developed by Artifex Software, Inc. \
                    \
                    MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB \
                    and FB2 (eBooks) formats, and it is known for its top \
                    performance and exceptional rendering quality. \
                    \
                    With PyMuPDF you can access files with extensions \
                    like .pdf, .xps, .oxps, .cbz, .fb2 or .epub. In addition, \
                    about 10 popular image formats can also be handled \
                    like documents: .png, .jpg, .bmp, .tiff etc.

homepage            https://pymupdf.readthedocs.io

checksums           rmd160  e505b63b8c7a1323a3d6e38f3ffffe5901273645 \
                    sha256  b93ac217a9141503129901a4e86a88a54a21bbfc01d720ce36d986710881a960 \
                    size    30495875

python.versions     310 311 312

if {${name} ne ${subport}} {
    depends_build-append \
                    port:swig-python
    depends_lib-append \
                    port:freetype \
                    port:mupdf

    patchfiles      patch-build.diff

    # link.h: error: redefinition of typedef ‘fz_link’
    # document.h: error: redefinition of typedef ‘pdf_document’
    compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

    build.env-append \
                    PYMUPDF_INCLUDES=${prefix}/include:${prefix}/include/freetype2 \
                    PYMUPDF_MUPDF_LIB=${prefix}/lib \
                    PYMUPDF_SETUP_IMPLEMENTATIONS=a \
                    PYMUPDF_SETUP_MUPDF_BUILD=
}
