# -*- 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

github.setup        flexpaper pdf2json 0.71
revision            0
categories          textproc
maintainers         {@flexpaper devaldi.com:pdf2json} openmaintainer
license             GPL-2

description         PDF to JSON conversion utility

long_description    PDF2JSON is a conversion library based on XPDF (3.02) \
                    which can be used for high performance PDF page by page \
                    conversion to JSON and XML format.

github.tarball_from releases

checksums           rmd160  0966109200f64d69201ca9f7f369f6c56b757965 \
                    sha256  0acaeeceec95c3d9b3727ac7fbb73dbbbfb6e3e6e1f36abd192eb22ca1ac73f5 \
                    size    1214231

extract.mkdir       yes

patchfiles          patch-Makefiles.diff

post-patch {
    reinplace "s|/usr/local|${prefix}|g" \
        ${worksrcpath}/doc/sample-xpdfrc \
        ${worksrcpath}/xpdf/GlobalParams.cc
}

# remove files already provided by poppler and xpdf
post-destroot {
    file delete -force -- ${destroot}${prefix}/share
    file delete -force -- ${destroot}${prefix}/etc
    foreach f {pdfinfo pdftotext pdfimages pdffonts pdftops} {
        file delete ${destroot}${prefix}/bin/$f
    }
}
