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

name                gnu-apl
version             1.9
revision            0
checksums           rmd160  64859c2a8e55ea0cbcc884ea1a61eb4f31ada5ae \
                    sha256  291867f1b1937693abb57be7d9a37618b0376e3e2709574854a7bbe52bb28eb8 \
                    size    4736165

categories          lang
license             GPL-3+
maintainers         {@casouri gmail.com:casouri} openmaintainer

description         GNU APL is a free interpreter for the programming language APL.

long_description    GNU APL is a free interpreter for the programming language APL. \
                    The APL interpreter is an (almost) complete implementation of ISO \
                    standard 13751 aka. Programming Language APL, Extended.

homepage            https://www.gnu.org/software/apl/
master_sites        gnu:apl
distname            apl-${version}

depends_lib         port:fftw-3 \
                    port:libpng \
                    port:pcre2 \
                    port:readline \
                    port:sqlite3 \
                    port:xorg-libX11 \
                    port:xorg-libxcb \
                    port:zlib

depends_run         port:apl_select

select.group        apl
select.file         ${filespath}/${name}

livecheck.type      regex
livecheck.regex     apl-(\[0-9.\]+)[quotemeta ${extract.suffix}]

patchfiles          dynamic_lookup-11.patch

# error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short')
# to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
# https://savannah.gnu.org/bugs/index.php?67543
configure.cxxflags-append -Wno-error=c++11-narrowing

# Do not use -Werror.
configure.env       CXX_WERROR=no

configure.args      --with-pcre=${prefix} \
                    --with-sqlite3=${prefix} \
                    --without-postgresql

# Don't find gtk3. This project's gtk3-using code is not macOS-compatible.
configure.env-append \
                    PKG_CONFIG=false

post-destroot {
    file rename ${destroot}${prefix}/bin/apl ${destroot}${prefix}/bin/gnu-apl
}

test.run            yes
test.target         check

notes               "
                    gnu-apl has been installed as gnu-apl. You can use\
                    “sudo port select --set apl gnu-apl”\
                    to set gnu-apl as default APL executable.

                    Info file is installed under ${prefix}/share/info.\
                    You need to set \$INFOPATH accordingly in order to view them.
                    "
