# -*- 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
PortGroup           compiler_blacklist_versions 1.0
PortGroup           legacysupport 1.1

github.setup        Genivia ugrep 7.4.2 v
github.tarball_from archive
revision            0

categories          textproc sysutils
license             BSD
maintainers         {reneeotten @reneeotten} openmaintainer

description         ultra fast grep with interactive query UI and fuzzy search
long_description    {*}${description}: search file systems, source code, text, \
                    binary files, archives (cpio/tar/pax/zip), compressed files \
                    (gz/Z/bz2/lzma/xz/lz4/zstd), documents and more.

checksums           rmd160  e8cff5465680413fb53695dd29f03daaa4910ca1 \
                    sha256  402be01d327e4b65a0f93683bdb9859e4daa7aca29d85b00e668de4e42831c78 \
                    size    7226491

compiler.cxx_standard 2011

# fix build failure on OS X 10.9 and 10.8:
# /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/list:227:9: error: field has incomplete type 'GrepWorker'
# see: https://github.com/Genivia/ugrep/issues/130
compiler.blacklist-append {clang < 700}

legacysupport.newest_darwin_requires_legacy 10
# needed for strnlen

depends_lib-append  port:pcre2 \
                    port:zlib \
                    port:bzip2 \
                    port:lzma \
                    port:lz4 \
                    port:zstd

configure.args      --disable-silent-rules \
                    --without-boost-regex \
                    --with-pcre2=${prefix} \
                    --with-zlib=${prefix} \
                    --with-bzlib=${prefix} \
                    --with-lzma=${prefix} \
                    --with-lz4=${prefix} \
                    --with-zstd=${prefix} \
                    --without-brotli \
                    --without-bzip3 \
                    --disable-avx2 \
                    --disable-sse2 \
                    --disable-neon

variant native description {Enable CPU-specific optimizations} {
    configure.args-delete \
                    --disable-avx2 \
                    --disable-sse2 \
                    --disable-neon
}

test.run            yes
