# -*- 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        skvadrik re2c 4.3
revision            0
checksums           rmd160  f6d4bf6a2154fedd866dce4ba87a95ae9e0095a8 \
                    sha256  7ddf60bc81b2442f7c8f1ec092e164fbb1edf9d62f3babc882e4fac270630a9b \
                    size    1679769

# The datetime parsers in php must be generated with this version or older.
subport ${name}-0.15 {
    github.setup    ${github.author} ${github.project} 0.15.3
    revision        0
    checksums       rmd160  a8867ba92ad3a9712a814b15a0cc7b6d0b51e995 \
                    sha256  f9d2a96c60a8c60d9c6c70e10590cbceaf0776d3115e7b3b35c7d7240cc1613b \
                    size    4881197

    configure.args-append \
                    --program-suffix=-0.15
}

categories          devel
license             public-domain
maintainers         {ryandesign @ryandesign} openmaintainer

description         A tool for generating C-based recognizers from regular \
                    expressions.

long_description    re2c is a tool for generating C-based recognizers from \
                    regular expressions. re2c-based scanners are efficient: an \
                    re2c-based scanner is said to be typically almost twice as fast as \
                    a flex-based scanner with little or no increase in size.

homepage            https://re2c.org
github.tarball_from releases
if {${subport} eq ${name}} {
    use_lzip                    yes

    compiler.cxx_standard       2011

    if {${os.platform} eq "darwin" && ${os.major} < 19} {
        depends_build-append    port:python313
        configure.python        ${prefix}/bin/python3.13
    } else {
        configure.python        /usr/bin/python3
    }
}

depends_build-append \
                    port:bison

configure.args-append \
                    --disable-silent-rules

# If future versions exhibit compile errors like
# "error: no match for 'operator!='" (gcc-4.2) or
# "error: invalid operands to binary expression" (clang-3.4)
# with regard to ".rend()" it can possibly be fixed. See
# https://github.com/skvadrik/re2c/issues/198 for discussion and fix.

test.run            yes
test.target         check
# make sed happy
test.env            LANG=C

if {${subport} ne ${name}} {
    livecheck.type  none
}
