# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           legacysupport 1.1
PortGroup           makefile 1.0

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

github.setup        davidesantangelo krep 1.4.0 v
github.tarball_from archive
revision            0

description         A High-Performance String Search Utility

long_description    \
    ${name} is a blazingly fast string search utility designed for \
    performance-critical applications. It implements multiple optimized \
    search algorithms and leverages modern hardware capabilities to deliver \
    maximum throughput.

checksums           rmd160  76289b8616f0f406c0a429c7a43d9681d1fbeaed \
                    sha256  0508099e1de0c38d35afad283586798fcb9cbd5c3ddbdae4028a6dfdba205405 \
                    size    70102

categories          textproc
installs_libs       no
license             BSD
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

build.args-append   ENABLE_ARCH_DETECTION=0

compiler.c_standard 2011
# krep.h:15:10: fatal error: 'stdatomic.h' file not found
compiler.blacklist-append \
                    {clang < 700}

patch {
    reinplace -E {s|CC =|CC ?=|g}           ${worksrcpath}/Makefile
    reinplace -E {s|CFLAGS =|CFLAGS ?=|g}   ${worksrcpath}/Makefile
    reinplace -E {s|LDFLAGS =|LDFLAGS ?=|g} ${worksrcpath}/Makefile
    # Remove below at next upgrade
    reinplace -E {s|#define VERSION "1.2"|#define VERSION "1.3"|g} ${worksrcpath}/krep.c
}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
}
