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

# GitHub version lags behind.
R.setup             cran ropensci tesseract 5.2.2
revision            0
categories-append   textproc
maintainers         nomaintainer
license             Apache-2
description         Open Source OCR Engine
long_description    {*}${description}
checksums           rmd160  7d21eebda7bf3fda45286f555a3060f58c2a1dc8 \
                    sha256  3ac22cfd9376832664d4df8f4c9b290c4fb07fe324e89ea161a157275b507a55 \
                    size    461663

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:R-curl \
                    port:R-digest \
                    port:R-pdftools \
                    port:R-rappdirs \
                    port:R-Rcpp \
                    port:tesseract

if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libc++"} {
    patchfiles-append \
                    patch-cxx11.diff
}

# While the package can be installed without any languages in tesseract share folder,
# there is an error message at load time. So let us add some.
depends_run-append  port:tesseract-chi-tra \
                    port:tesseract-deu \
                    port:tesseract-eng \
                    port:tesseract-fra \
                    port:tesseract-heb \
                    port:tesseract-jav \
                    port:tesseract-kor \
                    port:tesseract-rus \
                    port:tesseract-san \
                    port:tesseract-spa

depends_test-append port:R-knitr \
                    port:R-magick \
                    port:R-rmarkdown \
                    port:R-spelling \
                    port:R-tibble

test.run            yes
