# -*- 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        opencog link-grammar 5.12.4 link-grammar-
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
checksums           rmd160  37c3bf7eaace1a77d0749b6002770f0fbcb56c6a \
                    sha256  9bb7b8764d0e78c198e994af0b70a69cada3a35aa48a6deea620487fc75cfb00 \
                    size    4720724

categories          textproc
license             LGPL-2.1 MIT
maintainers         {ryandesign @ryandesign} openmaintainer

description         Link Grammar Parser

long_description    The Link Grammar Parser is a syntactic parser of English, \
                    based on link grammar, an original theory of English \
                    syntax. Given a sentence, the system assigns to it a \
                    syntactic structure, which consists of a set of labeled \
                    links connecting pairs of words. The parser also produces \
                    a \"constituent\" (Penn tree-bank style phrase tree) \
                    representation of a sentence (showing noun phrases, \
                    verb phrases, etc.).

homepage            https://opencog.github.io/link-grammar-website/
master_sites        https://www.gnucash.org/link-grammar/downloads/${version}/

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

depends_lib-append  port:hunspell \
                    port:libedit \
                    port:sqlite3
#                    port:pcre2 \

# clang: error: no such file or directory: '/usr/bin/clang"'
configure.ccache    no

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

compiler.c_standard 2011
compiler.cxx_standard \
                    2017

# Using pcre2 is recommended but it fails to build on macOS.
# https://github.com/opencog/link-grammar/issues/1495
configure.args-append \
                    --disable-pcre2 \
                    --disable-silent-rules \
                    --enable-editline \
                    --with-regexlib=c
#                    --with-regexlib=pcre2

# link-grammar does not recommend the use of aspell due to memory leaks and
# disables the use of aspell if hunspell is used.
configure.args-append \
                    --disable-aspell \
                    --enable-hunspell

# Enabling language bindings has not yet been investigated; they're disabled
# in the interest of simplicity.
configure.args-append \
                    --disable-java-bindings \
                    --disable-perl-bindings \
                    --disable-python-bindings

# Enable the sat solver because why not. When the sat solver is enabled, it
# builds with C++ and links with zlib. Use the bundled copy of minisat because
# the minisat port only provides a binary, not the needed library.
configure.args-append \
                    --enable-sat-solver=bundled

variant track_space_usage description {Track space usage to help with debugging} {
    configure.cppflags-append -DTRACK_SPACE_USAGE
}
