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

github.setup        unpaper unpaper 7.0.0 unpaper-
github.tarball_from releases
use_xz              yes

revision            1
categories          graphics
maintainers         {@akierig fastmail.de:akierig} openmaintainer
license             GPL-2

description         Post-processing scanned and photocopied book pages
long_description    unpaper is a post-processing tool for scanned sheets of paper, especially for book pages that have been scanned from previously created photocopies. \
                    The main purpose is to make scanned book pages better readable on screen after conversion to PDF. \
                    Additionally, unpaper might be useful to enhance the quality of scanned pages before performing optical character recognition (OCR).

homepage            https://www.flameeyes.eu/projects/unpaper

checksums           rmd160  704cbff899afa1a21268351afbcb76556422844d \
                    sha256  2575fbbf26c22719d1cb882b59602c9900c7f747118ac130883f63419be46a80 \
                    size    4430572

set py_ver          3.12
set py_ver_nodot    [string map {. {}} ${py_ver}]
set ffmpeg_ver      7

depends_build-append \
                    port:libxslt \
                    port:netpbm \
                    path:bin/pkg-config:pkgconfig \
                    port:py${py_ver_nodot}-sphinx
depends_lib         port:ffmpeg${ffmpeg_ver}
depends_run         port:netpbm

# meson.build: ERROR: Problem encountered: A C library compatible with POSIX.1-2008 is required.
# project('unpaper', 'c', version : '7.0.0', default_options : ['c_std=c11'])
compiler.c_standard 2011

configure.pkg_config_path   ${prefix}/libexec/ffmpeg${ffmpeg_ver}/lib/pkgconfig

pre-configure {
    reinplace "s|sphinx-build|sphinx-build-${py_ver}|" ${worksrcpath}/meson.build
}
