1*edff4923SAndrew GeisslerSUMMARY = "Fast Log processor and Forwarder"
2*edff4923SAndrew GeisslerDESCRIPTION = "Fluent Bit is a data collector, processor and  \
3*edff4923SAndrew Geisslerforwarder for Linux. It supports several input sources and \
4*edff4923SAndrew Geisslerbackends (destinations) for your data. \
5*edff4923SAndrew Geissler"
6*edff4923SAndrew Geissler
7*edff4923SAndrew GeisslerHOMEPAGE = "http://fluentbit.io"
8*edff4923SAndrew GeisslerBUGTRACKER = "https://github.com/fluent/fluent-bit/issues"
9*edff4923SAndrew Geissler
10*edff4923SAndrew GeisslerLICENSE = "Apache-2.0"
11*edff4923SAndrew GeisslerLIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
12*edff4923SAndrew GeisslerSECTION = "net"
13*edff4923SAndrew Geissler
14*edff4923SAndrew GeisslerSRC_URI = "https://releases.fluentbit.io/1.9/source-${PV}.tar.gz;subdir=fluent-bit-${PV};downloadfilename=${BPN}-${PV}.tar.gz \
15*edff4923SAndrew Geissler           file://0001-CMakeLists.txt-Do-not-use-private-makefile-target.patch \
16*edff4923SAndrew Geissler           file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \
17*edff4923SAndrew Geissler           file://0003-mbedtls-Do-not-overwrite-CFLAGS.patch \
18*edff4923SAndrew Geissler           file://0004-build-Make-systemd-init-systemd-detection-contingent.patch \
19*edff4923SAndrew Geissler           file://0001-monkey-Define-_GNU_SOURCE-for-memmem-API-check.patch \
20*edff4923SAndrew Geissler           file://0002-mbedtls-Remove-unused-variable.patch \
21*edff4923SAndrew Geissler           file://0003-mbedtls-Disable-documentation-warning-as-error-with-.patch \
22*edff4923SAndrew Geissler           file://0004-Use-correct-type-to-store-return-from-flb_kv_item_cr.patch \
23*edff4923SAndrew Geissler           file://0005-stackdriver-Fix-return-type-mismatch.patch \
24*edff4923SAndrew Geissler           file://0006-monkey-Fix-TLS-detection-testcase.patch \
25*edff4923SAndrew Geissler           file://0007-cmake-Do-not-check-for-upstart-on-build-host.patch \
26*edff4923SAndrew Geissler           "
27*edff4923SAndrew GeisslerSRC_URI:remove:x86 = "file://0002-mbedtls-Remove-unused-variable.patch"
28*edff4923SAndrew GeisslerSRC_URI:append:libc-musl = "\
29*edff4923SAndrew Geissler           file://0001-Use-posix-strerror_r-with-musl.patch \
30*edff4923SAndrew Geissler           file://0002-chunkio-Link-with-fts-library-with-musl.patch \
31*edff4923SAndrew Geissler           "
32*edff4923SAndrew GeisslerSRC_URI[sha256sum] = "3f6cd4bd1894cda16b465aef6ffec7e920d54c4209b3e2320fcffe7ae345700e"
33*edff4923SAndrew GeisslerS = "${WORKDIR}/fluent-bit-${PV}"
34*edff4923SAndrew Geissler
35*edff4923SAndrew GeisslerDEPENDS = "zlib bison-native flex-native openssl"
36*edff4923SAndrew GeisslerDEPENDS += "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
37*edff4923SAndrew Geissler
38*edff4923SAndrew GeisslerPACKAGECONFIG[yaml] = "-DFLB_CONFIG_YAML=On,-DFLB_CONFIG_YAML=Off,libyaml"
39*edff4923SAndrew GeisslerPACKAGECONFIG[kafka] = "-DFLB_OUT_KAFKA=On,-DFLB_OUT_KAFKA=Off,librdkafka"
40*edff4923SAndrew GeisslerPACKAGECONFIG[examples] = "-DFLB_EXAMPLES=On,-DFLB_EXAMPLES=Off"
41*edff4923SAndrew GeisslerPACKAGECONFIG[jemalloc] = "-DFLB_JEMALLOC=On,-DFLB_JEMALLOC=Off,jemalloc"
42*edff4923SAndrew Geissler#TODO add more fluentbit options to PACKAGECONFIG[]
43*edff4923SAndrew Geissler
44*edff4923SAndrew GeisslerDEPENDS:append:libc-musl = " fts "
45*edff4923SAndrew Geissler
46*edff4923SAndrew Geissler# flex hardcodes the input file in #line directives leading to TMPDIR contamination of debug sources.
47*edff4923SAndrew Geisslerdo_compile:append() {
48*edff4923SAndrew Geissler    find ${B} -name '*.c' -or -name '*.h' | xargs sed -i -e 's|${TMPDIR}|${TARGET_DBGSRC_DIR}/|g'
49*edff4923SAndrew Geissler}
50*edff4923SAndrew Geissler
51*edff4923SAndrew GeisslerPACKAGECONFIG ?= "yaml"
52*edff4923SAndrew Geissler
53*edff4923SAndrew GeisslerLTO = ""
54*edff4923SAndrew Geissler
55*edff4923SAndrew Geissler# Use CMake 'Unix Makefiles' generator
56*edff4923SAndrew GeisslerOECMAKE_GENERATOR ?= "Unix Makefiles"
57*edff4923SAndrew Geissler
58*edff4923SAndrew Geissler# Fluent Bit build options
59*edff4923SAndrew Geissler# ========================
60*edff4923SAndrew Geissler
61*edff4923SAndrew Geissler# Host related setup
62*edff4923SAndrew GeisslerEXTRA_OECMAKE += "-DGNU_HOST=${HOST_SYS} -DFLB_TD=1"
63*edff4923SAndrew Geissler
64*edff4923SAndrew Geissler# Disable LuaJIT and filter_lua support
65*edff4923SAndrew GeisslerEXTRA_OECMAKE += "-DFLB_LUAJIT=Off -DFLB_FILTER_LUA=Off "
66*edff4923SAndrew Geissler
67*edff4923SAndrew Geissler# Disable Library and examples
68*edff4923SAndrew GeisslerEXTRA_OECMAKE += "-DFLB_SHARED_LIB=Off"
69*edff4923SAndrew Geissler
70*edff4923SAndrew Geissler# Enable systemd iff systemd is in DISTRO_FEATURES
71*edff4923SAndrew GeisslerEXTRA_OECMAKE += "${@bb.utils.contains('DISTRO_FEATURES','systemd','-DFLB_SYSTEMD=On','-DFLB_SYSTEMD=Off',d)}"
72*edff4923SAndrew Geissler
73*edff4923SAndrew Geissler# Enable release builds
74*edff4923SAndrew GeisslerEXTRA_OECMAKE += "-DFLB_RELEASE=On"
75*edff4923SAndrew Geissler
76*edff4923SAndrew Geissler# musl needs these options
77*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:libc-musl = ' -DFLB_JEMALLOC_OPTIONS="--with-jemalloc-prefix=je_ --with-lg-quantum=3" -DFLB_CORO_STACK_SIZE=24576'
78*edff4923SAndrew Geissler
79*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:riscv64 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
80*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:riscv32 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
81*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:mips = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
82*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:powerpc = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
83*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:x86 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
84*edff4923SAndrew Geissler
85*edff4923SAndrew GeisslerCFLAGS:append:x86 = " -DMBEDTLS_HAVE_SSE2"
86*edff4923SAndrew Geissler
87*edff4923SAndrew Geissler# Fixes build with GCC-14
88*edff4923SAndrew GeisslerCFLAGS += "-Wno-error=incompatible-pointer-types"
89*edff4923SAndrew Geissler
90*edff4923SAndrew Geisslerinherit cmake systemd pkgconfig
91*edff4923SAndrew Geissler
92*edff4923SAndrew GeisslerSYSTEMD_SERVICE:${PN} = "td-agent-bit.service"
93*edff4923SAndrew Geissler
94*edff4923SAndrew GeisslerEXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/"
95*edff4923SAndrew GeisslerTARGET_CC_ARCH += " ${SELECTED_OPTIMIZATION}"
96