# -*- 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.5.1
revision            0
checksums           rmd160  989d233b7862c66c4664f7ee5c2e47caceaf078b \
                    sha256  af85de20a6d780f2ef345eac81b35786eded075dc468384f79a65ad1059dc50d \
                    size    1762584

# 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

    patchfiles                  max_align_t.patch

    compiler.cxx_standard       2011

    if {${os.platform} eq "darwin" && ${os.major} < 19} {
        depends_build-append    port:python314
        configure.python        ${prefix}/bin/python3.14
    } 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
}
