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

epoch               1
github.setup        agl jbig2enc 0.29
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            1
categories          graphics
license             GPL-2
maintainers         {takeshi @tenomoto} openmaintainer
description         JBIG2 Encoder
long_description \
    JBIG2 encodes bi-level (1 bpp) images using a number of \
    clever tricks to get better compression than G4. \
    This encoder can: \
        * Generate JBIG2 files, or fragments for embedding in PDFs \
        * Generic region encoding \
        * Perform symbol extraction, classification and text region coding \
        * Perform refinement coding and, \
        * Compress multipage documents

checksums           rmd160  6b07eb366ff6c22f61938a4a7b3d848a3da619ba \
                    sha256  778c3a03572556978a209b3c2ac765ecacb5c25355dc72b61318b3ffc06dc134 \
                    size    1108219

depends_build       port:autoconf port:automake port:libtool
depends_lib         port:leptonica

# apply unreleased upstream patches to fix build with leptonica 1.83+
patchfiles          jbig2enc-a614bdb580d65653dbfe5c9925940797a065deac.patch \
                    jbig2enc-d211d8c9c65fbc103594580484a3b7fa0249e160.patch

patch.pre_args-replace  -p0 -p1

configure.cmd       "./autogen.sh && ./configure"
configure.args      --docdir=${prefix}/share/doc/${name}

configure.universal_args-delete --disable-dependency-tracking

post-destroot {
    file rename ${destroot}${prefix}/bin/pdf.py ${destroot}${prefix}/bin/${name}_pdf.py
}
