# -*- 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           cmake                       1.1
PortGroup           compiler_blacklist_versions 1.0
PortGroup           github                      1.0
PortGroup           openssl                     1.0

# Need clock_gettime()
PortGroup           legacysupport               1.1

legacysupport.newest_darwin_requires_legacy     15

github.setup        fluent fluent-bit 3.1.9 v
github.tarball_from archive
revision            0
categories          sysutils
license             Apache-2

homepage            https://fluentbit.io

description         Fast and Lightweight Log processor and forwarder

long_description    Fluent Bit is a Data Forwarder for Linux, Embedded Linux, \
                    OSX and BSD family operating systems. It's part of the \
                    Fluentd Ecosystem.  Fluent Bit allows collection of \
                    information from different sources, buffering and \
                    dispatching them to different outputs such as Fluentd, \
                    Elasticsearch, Nats or any HTTP end-point within others.

maintainers         {l2dy @l2dy} \
                    {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  15118adb555e883431bfe84cf77c77cb5785980f \
                    sha256  ac3a3e235e7f8a92d35f10c99f400f0b0571417a92e3c4caa467073733d42547 \
                    size    26801853

patchfiles-append   0001-macos-setup-do-not-use-clang-flag-with-gcc.patch \
                    0002-posix_file.c-add-a-missing-header.patch \
                    0003-libatomic-gcc.patch \
                    0004-snappy-compat.h-fix-Big-endian-on-Apple.patch \
                    0005-mk_scheduler-fix-for-missing-pthread_threadid_np.patch \
                    0007-Fix-for-meminfo-on-32-bit-darwin.patch

# At least for atomics and some modules
compiler.cxx_standard       2011
# /usr/bin/ranlib: unknown option character `n' in: -no_warning_for_no_symbols
compiler.blacklist-append   {clang < 700}

set python_version  312
set python_branch   \
    [string index ${python_version} 0].[string range ${python_version} 1 end]

depends_build-append        port:bison \
                            port:python${python_version}

depends_lib-append          port:cyrus-sasl2 \
                            port:jansson \
                            port:libev \
                            port:libevent \
                            port:libxml2 \
                            port:libyaml \
                            port:ngtcp2 \
                            port:nghttp3 \
                            port:sqlite3 \
                            port:zlib \
                            port:zstd

configure.args-append       \
    -DPython3_EXECUTABLE=${prefix}/bin/python${python_branch}

platform powerpc {
    # Unsupported on any powerpc:
    configure.args-append   -DFLB_WASM=OFF
}

platform darwin powerpc {
    # Disable what is presently broken:
    configure.args-append   -DFLB_LUAJIT=OFF \
                            -DFLB_VALGRIND=OFF
    # Undefined symbols: "__Unwind_Backtrace", "__Unwind_GetIPInfo"
    # FIXME: this is probably a fixable error.
    configure.args-append   -DFLB_BACKTRACE=OFF
}

github.livecheck.regex      {([0-9.]+)}