# -*- 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           cmake           1.1
PortGroup           github          1.0
PortGroup           legacysupport   1.1

# please rev-bump enchant2 when the library version changes
github.setup        nuspell nuspell 5.1.6 v
github.tarball_from archive
revision            1

homepage            https://nuspell.github.io

description         Fast and safe spellchecking C++ library

long_description    Nuspell is a fast and safe spelling checker software \
                    program. It is designed for languages with rich \
                    morphology and complex word compounding. Nuspell is \
                    written in modern C++ and it supports Hunspell \
                    dictionaries.

categories          textproc
license             LGPL-3+
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  b1a86921f3120d4dea2a581122a1fb77f9f6ea9e \
                    sha256  5d4baa1daf833a18dc06ae0af0571d9574cc849d47daff6b9ce11dac0a5ded6a \
                    size    373260

depends_lib-append  path:lib/pkgconfig/icu-uc.pc:icu

compiler.cxx_standard \
                    2017

configure.args-append \
                    -DBUILD_DOCS=OFF \
                    -DBUILD_TESTING=OFF

set hunspell_path   ${prefix}/share/hunspell

patchfiles          patch-finder-cxx.diff

post-patch {
    reinplace       "s|@@HUNSPELL_PATH@@|${hunspell_path}|g" \
                    ${worksrcpath}/src/nuspell/finder.cxx
}

variant docs description {Build documentation} {
    depends_build-append \
                    port:pandoc

    configure.args-replace \
                    -DBUILD_DOCS=OFF -DBUILD_DOCS=ON
}

notes "
You must install (at least) one of the language dictionaries after installing\
this port in order for it to work.

One suggestion is the Hunspell US English dictionary:
\$ sudo port install hunspell-en_US
"
