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

PortSystem                                      1.0
PortGroup           cmake                       1.1
PortGroup           github                      1.0
PortGroup           boost                       1.0
PortGroup           legacysupport               1.1

# strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        intel hyperscan 5.4.2 v
revision            1
checksums           rmd160  c91b17e2f93f1065e9244f6bb7b66eb9dd6ea5dd \
                    sha256  32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99 \
                    size    1848851

categories          textproc
license             BSD
maintainers         nomaintainer

description         High-performance regular expression matching library.

long_description    {*}${description} It follows the regular \
                    expression syntax of the commonly-used libpcre \
                    library, but is a standalone library with its own \
                    C API.  Hyperscan uses hybrid automata techniques \
                    to allow simultaneous matching of large numbers \
                    (up to tens of thousands) of regular expressions \
                    and for the matching of regular expressions across \
                    streams of data.  Hyperscan is typically used in a \
                    DPI library stack.

homepage            https://www.hyperscan.io/
github.tarball_from archive

# https://github.com/intel/hyperscan/issues/197
supported_archs     x86_64

conflicts           vectorscan

# Use ${python.default_version}
# name consistency with ${prefix}/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/python-1.0.tcl
set python_default_version 313
set python_version  ${python_default_version}
set python_branch   [string index ${python_version} 0].[string range ${python_version} 1 end]

depends_build-append \
    port:pkgconfig \
    port:python${python_version} \
    port:ragel

depends_lib-append \
    port:pcre \
    port:sqlite3

compiler.cxx_standard   2011

# The flag `-DCMAKE_BUILD_TYPE=MacPorts` adds -Werror, which causes compile errors with -Wshadow
# Reference: https://github.com/intel/hyperscan/blob/master/CMakeLists.txt
cmake.build_type    Release

configure.args-append \
    -DBUILD_STATIC_AND_SHARED=ON \
    -DPYTHON_EXECUTABLE=${prefix}/bin/python${python_branch}

variant native {}
if {![variant_isset native]} {
    patchfiles-append no-march-native.patch
}
