From aaebfe4452d984160dd180e0cd0fada54317f407 Mon Sep 17 00:00:00 2001 From: Patrick Wicki Date: Fri, 28 Nov 2025 21:48:25 +0100 Subject: fluentbit: upgrade 4.0.1 -> 4.2.0 Refresh patches and drop one for musl which is no longer required. Release notes: - https://fluentbit.io/announcements/v4.1.0/ - https://fluentbit.io/announcements/v4.2.0/ This addresses CVE-2025-12977. Signed-off-by: Patrick Wicki Signed-off-by: Khem Raj --- ...use-private-makefile-targets-in-CMakelist.patch | 14 +- ...in-Do-not-hardcode-compilation-directorie.patch | 8 +- ...keLists.txt-Revise-init-manager-deduction.patch | 8 +- ...4-chunkio-Link-with-fts-library-with-musl.patch | 7 +- .../0005-Use-posix-strerror_r-with-musl.patch | 31 ----- .../recipes-extended/fluentbit/fluentbit_4.0.1.bb | 151 --------------------- .../recipes-extended/fluentbit/fluentbit_4.2.0.bb | 150 ++++++++++++++++++++ 7 files changed, 175 insertions(+), 194 deletions(-) delete mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0005-Use-posix-strerror_r-with-musl.patch delete mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit_4.2.0.bb diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch index 32f4fdec51..1756d74560 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch @@ -1,4 +1,4 @@ -From 7e6295f14ea057562a235fbf6762d867e739a181 Mon Sep 17 00:00:00 2001 +From 4b47a8f0e3d1d429356cdda8efa7682ab88d344a Mon Sep 17 00:00:00 2001 From: Niko Mauno Date: Sun, 29 Sep 2024 12:00:00 +0000 Subject: [PATCH] lib: Do not use private makefile targets in CMakelists.txt @@ -28,6 +28,8 @@ Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/9450] lib/monkey/CMakeLists.txt | 4 +--- 4 files changed, 7 insertions(+), 21 deletions(-) +diff --git a/lib/cfl/CMakeLists.txt b/lib/cfl/CMakeLists.txt +index 489570026..06d99cbbe 100644 --- a/lib/cfl/CMakeLists.txt +++ b/lib/cfl/CMakeLists.txt @@ -40,12 +40,8 @@ if(NOT MSVC) @@ -45,6 +47,8 @@ Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/9450] +diff --git a/lib/cmetrics/CMakeLists.txt b/lib/cmetrics/CMakeLists.txt +index 5421f8c80..0dcf7645c 100644 --- a/lib/cmetrics/CMakeLists.txt +++ b/lib/cmetrics/CMakeLists.txt @@ -60,12 +60,8 @@ if(NOT MSVC) @@ -61,11 +65,13 @@ Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/9450] +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__") # Configuration options - option(CMT_DEV "Enable development mode" No) + option(CMT_DEV "Enable development mode" No) +diff --git a/lib/ctraces/CMakeLists.txt b/lib/ctraces/CMakeLists.txt +index 73723433d..9f60699d5 100644 --- a/lib/ctraces/CMakeLists.txt +++ b/lib/ctraces/CMakeLists.txt @@ -30,12 +30,8 @@ set(CTR_VERSION_MINOR 6) - set(CTR_VERSION_PATCH 4) + set(CTR_VERSION_PATCH 6) set(CTR_VERSION_STR "${CTR_VERSION_MAJOR}.${CTR_VERSION_MINOR}.${CTR_VERSION_PATCH}") -# Define __FILENAME__ consistently across Operating Systems @@ -79,6 +85,8 @@ Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/9450] # Configuration options option(CTR_DEV "Enable development mode" No) +diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt +index 3fbace595..1c6ad031c 100644 --- a/lib/monkey/CMakeLists.txt +++ b/lib/monkey/CMakeLists.txt @@ -15,10 +15,8 @@ include(GNUInstallDirs) diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch index 025f8729ea..4c6cac0cbd 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch @@ -1,4 +1,4 @@ -From c8c9dd3aeb49ab2ec94c3ab081e2368736a5da20 Mon Sep 17 00:00:00 2001 +From 596a53c35166e6cc5c20fb1d28bb5c92a248f695 Mon Sep 17 00:00:00 2001 From: Paulo Neves Date: Thu, 28 Jul 2022 11:42:31 +0200 Subject: [PATCH] flb_info.h.in: Do not hardcode compilation directories @@ -7,12 +7,14 @@ Including the source dir in the header makes the header not reproducible and contaminates it with host builder paths. Instead make it take CMAKE_DEBUG_SRCDIR that can be set to a known reproducible value ---- -Upstream-Status: Pending +Upstream-Status: Pending +--- include/fluent-bit/flb_info.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) +diff --git a/include/fluent-bit/flb_info.h.in b/include/fluent-bit/flb_info.h.in +index 3a08f8051..aa6a48f29 100644 --- a/include/fluent-bit/flb_info.h.in +++ b/include/fluent-bit/flb_info.h.in @@ -23,7 +23,7 @@ diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch index 909d1be28d..6bd4c6bbb6 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch @@ -1,4 +1,4 @@ -From bf4e832544e8aa5866ef57859f95b71bd8811154 Mon Sep 17 00:00:00 2001 +From 5cc79bdede89e75d713e23cf0fde26634320bc3e Mon Sep 17 00:00:00 2001 From: Niko Mauno Date: Mon, 21 Oct 2024 16:02:46 +0000 Subject: [PATCH] CMakeLists.txt: Revise init manager deduction @@ -14,9 +14,11 @@ Upstream-Status: Inappropriate [configuration] src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index ac5fe5ef8..f47a01b82 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -569,7 +569,7 @@ if(FLB_BINARY) +@@ -600,7 +600,7 @@ if(FLB_BINARY) set(SYSTEMD_UNITDIR /lib/systemd/system) endif() @@ -25,7 +27,7 @@ Upstream-Status: Inappropriate [configuration] if (FLB_AMAZON_LINUX2) set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service") configure_file( -@@ -594,7 +594,7 @@ if(FLB_BINARY) +@@ -625,7 +625,7 @@ if(FLB_BINARY) install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION ${SYSTEMD_UNITDIR}) install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary) endif() diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0004-chunkio-Link-with-fts-library-with-musl.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-chunkio-Link-with-fts-library-with-musl.patch index c34a0ba71d..6df53613c3 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0004-chunkio-Link-with-fts-library-with-musl.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-chunkio-Link-with-fts-library-with-musl.patch @@ -1,4 +1,4 @@ -From a07df56092e529627db0946c025cb4964567280c Mon Sep 17 00:00:00 2001 +From cc688b91c02df9a45ca8816a1d09649fadb9dc4a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 10 Aug 2022 01:27:16 -0700 Subject: [PATCH] chunkio: Link with fts library with musl @@ -7,14 +7,15 @@ Fixes cio_utils.c:(.text+0x64): undefined reference to `fts_read' Signed-off-by: Khem Raj ---- + Upstream-Status: Pending +--- lib/chunkio/src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/chunkio/src/CMakeLists.txt b/lib/chunkio/src/CMakeLists.txt -index bb52273d4..524500919 100644 +index 3590143fd..b43f08928 100644 --- a/lib/chunkio/src/CMakeLists.txt +++ b/lib/chunkio/src/CMakeLists.txt @@ -14,6 +14,7 @@ set(src diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0005-Use-posix-strerror_r-with-musl.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0005-Use-posix-strerror_r-with-musl.patch deleted file mode 100644 index 281bf66fb9..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0005-Use-posix-strerror_r-with-musl.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0c4310483875509f464883fa345f54e0d3ae25a5 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 10 Aug 2022 01:23:48 -0700 -Subject: [PATCH] Use posix strerror_r with musl - -Default with glibc is GNU extention of strerror_r -where as musl uses posix variant, call that out - -Upstream-Status: Inappropriate [Need wider porting beyond linux/musl/glibc] -Signed-off-by: Khem Raj - -Resolved conflicts while upgrading recipe from v1.9.9 to v3.1.9. - -Signed-off-by: Niko Mauno ---- - src/flb_network.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/flb_network.c b/src/flb_network.c -index 8f8ca33f6..dd098a2ea 100644 ---- a/src/flb_network.c -+++ b/src/flb_network.c -@@ -605,7 +605,7 @@ static int net_connect_async(int fd, - /* Connection is broken, not much to do here */ - #if ((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \ - (defined(_XOPEN_SOURCE) || _XOPEN_SOURCE - 0L >= 600L)) && \ -- (!defined(_GNU_SOURCE)) -+ (!defined(_GNU_SOURCE)) || (!defined(__GLIBC__)) - ret = strerror_r(error, so_error_buf, sizeof(so_error_buf)); - if (ret == 0) { - str = so_error_buf; diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb deleted file mode 100644 index 05e4fd937f..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb +++ /dev/null @@ -1,151 +0,0 @@ -SUMMARY = "Fast Log Processor and Forwarder" -DESCRIPTION = "Fluent Bit allows to collect log events or metrics from \ -different sources, process them and deliver them to different backends \ -such as Fluentd, Elasticsearch, Splunk, DataDog, Kafka, New Relic, Azure \ -services, AWS services, Google services, NATS, InfluxDB or any custom \ -HTTP end-point." -HOMEPAGE = "http://fluentbit.io" -BUGTRACKER = "https://github.com/fluent/fluent-bit/issues" -SECTION = "net" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" -DEPENDS = "\ - bison-native \ - flex-native \ - openssl \ - ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ -" -DEPENDS:append:libc-musl = " fts" - -SRCREV = "b12e507090273576d1156342780c7c6d358fa579" -SRC_URI = "\ - git://github.com/fluent/fluent-bit.git;branch=master;protocol=https \ - file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch \ - file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \ - file://0003-CMakeLists.txt-Revise-init-manager-deduction.patch \ -" -SRC_URI:append:libc-musl = "\ - file://0004-chunkio-Link-with-fts-library-with-musl.patch \ - file://0005-Use-posix-strerror_r-with-musl.patch \ -" - -# prefix tag with "v" to avoid upgrade to random tags like "20220215" -UPSTREAM_CHECK_GITTAGREGEX = "v(?P(\d+(\.\d+)+))" - - -PACKAGECONFIG ??= "\ - aws \ - binary \ - config-yaml \ - custom-calyptia \ - http-server \ - inotify \ - ipo \ - metrics \ - parser \ - prefer-system-libs \ - profiles \ - proxy-go \ - record-accessor \ - regex \ - signv4 \ - sqldb \ - stream-processor \ - tls \ - utf8-encoder \ -" -# See https://github.com/fluent/fluent-bit/issues/7248#issuecomment-1631280496 -PACKAGECONFIG:remove:toolchain-clang = "ipo" - -# Use system libs -PACKAGECONFIG[prefer-system-libs] = "-DFLB_PREFER_SYSTEM_LIBS=Yes,-DFLB_PREFER_SYSTEM_LIBS=No, nghttp2 c-ares" -DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs backtrace', 'libbacktrace', '', d)}" -DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs jemalloc', 'jemalloc', '', d)}" -DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs luajit', 'luajit', '', d)}" - -PACKAGECONFIG[all] = "-DFLB_ALL=Yes,-DFLB_ALL=No" -PACKAGECONFIG[arrow] = "-DFLB_ARROW=Yes,-DFLB_ARROW=No" -PACKAGECONFIG[avro-encoder] = "-DFLB_AVRO_ENCODER=Yes,-DFLB_AVRO_ENCODER=No" -PACKAGECONFIG[aws-error-reporter] = "-DFLB_AWS_ERROR_REPORTER=Yes,-DFLB_AWS_ERROR_REPORTER=No" -PACKAGECONFIG[aws] = "-DFLB_AWS=Yes,-DFLB_AWS=No" -PACKAGECONFIG[backtrace] = "-DFLB_BACKTRACE=Yes,-DFLB_BACKTRACE=No" -PACKAGECONFIG[binary] = "-DFLB_BINARY=Yes,-DFLB_BINARY=No" -PACKAGECONFIG[chunk-trace] = "-DFLB_CHUNK_TRACE=Yes,-DFLB_CHUNK_TRACE=No" -PACKAGECONFIG[config-yaml] = "-DFLB_CONFIG_YAML=Yes,-DFLB_CONFIG_YAML=No,libyaml" -PACKAGECONFIG[custom-calyptia] = "-DFLB_CUSTOM_CALYPTIA=Yes,-DFLB_CUSTOM_CALYPTIA=No" -PACKAGECONFIG[enforce-alignment] = "-DFLB_ENFORCE_ALIGNMENT=Yes,-DFLB_ENFORCE_ALIGNMENT=No" -PACKAGECONFIG[examples] = "-DFLB_EXAMPLES=Yes,-DFLB_EXAMPLES=No" -PACKAGECONFIG[http-client-debug] = "-DFLB_HTTP_CLIENT_DEBUG=Yes,-DFLB_HTTP_CLIENT_DEBUG=No" -PACKAGECONFIG[http-server] = "-DFLB_HTTP_SERVER=Yes,-DFLB_HTTP_SERVER=No" -PACKAGECONFIG[inotify] = "-DFLB_INOTIFY=Yes,-DFLB_INOTIFY=No" -PACKAGECONFIG[ipo] = "-DFLB_IPO=Yes,-DFLB_IPO=no" -PACKAGECONFIG[jemalloc] = "-DFLB_JEMALLOC=Yes,-DFLB_JEMALLOC=No,jemalloc" -PACKAGECONFIG[luajit] = "-DFLB_LUAJIT=Yes,-DFLB_LUAJIT=No" -PACKAGECONFIG[metrics] = "-DFLB_METRICS=Yes,-DFLB_METRICS=No" -PACKAGECONFIG[mtrace] = "-DFLB_MTRACE=Yes,-DFLB_MTRACE=No" -PACKAGECONFIG[parser] = "-DFLB_PARSER=Yes,-DFLB_PARSER=No" -PACKAGECONFIG[posix-tls] = "-DFLB_POSIX_TLS=Yes,-DFLB_POSIX_TLS=No" -PACKAGECONFIG[profiles] = "-DFLB_PROFILES=Yes,-DFLB_PROFILES=No" -PACKAGECONFIG[proxy-go] = "-DFLB_PROXY_GO=Yes,-DFLB_PROXY_GO=No" -PACKAGECONFIG[record-accessor] = "-DFLB_RECORD_ACCESSOR=Yes,-DFLB_RECORD_ACCESSOR=No" -PACKAGECONFIG[regex] = "-DFLB_REGEX=Yes,-DFLB_REGEX=No" -PACKAGECONFIG[run-ldconfig] = "-DFLB_RUN_LDCONFIG=Yes,-DFLB_RUN_LDCONFIG=No" -PACKAGECONFIG[shared-lib] = "-DFLB_SHARED_LIB=Yes,-DFLB_SHARED_LIB=No" -PACKAGECONFIG[signv4] = "-DFLB_SIGNV4=Yes,-DFLB_SIGNV4=No" -PACKAGECONFIG[sqldb] = "-DFLB_SQLDB=Yes,-DFLB_SQLDB=No" -PACKAGECONFIG[stream-processor] = "-DFLB_STREAM_PROCESSOR=Yes,-DFLB_STREAM_PROCESSOR=No" -PACKAGECONFIG[tests-runtime] = "-DFLB_TESTS_RUNTIME=Yes,-DFLB_TESTS_RUNTIME=No" -PACKAGECONFIG[tls] = "-DFLB_TLS=Yes,-DFLB_TLS=No" -PACKAGECONFIG[trace] = "-DFLB_TRACE=Yes,-DFLB_TRACE=No" -PACKAGECONFIG[utf8-encoder] = "-DFLB_UTF8_ENCODER=Yes,-DFLB_UTF8_ENCODER=No" -PACKAGECONFIG[valgrind] = "-DFLB_VALGRIND=Yes,-DFLB_VALGRIND=No,valgrind" -PACKAGECONFIG[wamrc] = "-DFLB_WAMRC=Yes,-DFLB_WAMRC=No" -PACKAGECONFIG[wasm-stack-protect] = "-DFLB_WASM_STACK_PROTECT=Yes,-DFLB_WASM_STACK_PROTECT=No" -PACKAGECONFIG[wasm] = "-DFLB_WASM=Yes,-DFLB_WASM=No" -PACKAGECONFIG[windows-defaults] = "-DFLB_WINDOWS_DEFAULTS=Yes,-DFLB_WINDOWS_DEFAULTS=No" - -# Option to disable all Fluent Bit plugins by default. See cmake/plugins_options.cmake which -# individual plugins then to enable (e.g. using EXTRA_OECMAKE:append = " -DFLB_FOOBAR=ON") -PACKAGECONFIG[minimal] = "-DFLB_MINIMAL=Yes,-DFLB_MINIMAL=No" - -PACKAGECONFIG[in-kafka] = "-DFLB_KAFKA=ON -DFLB_IN_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_IN_KAFKA=OFF,librdkafka curl" -PACKAGECONFIG[out-kafka] = "-DFLB_KAFKA=ON -DFLB_OUT_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_OUT_KAFKA=OFF,librdkafka curl" - -SYSTEMD_SERVICE:${PN} = "fluent-bit.service" - -inherit cmake systemd pkgconfig - -# disable manipulation of compiler flags and CMAKE_BUILD_TYPE -# release and coverage are off by default, disable also debug -EXTRA_OECMAKE += "-DFLB_DEBUG=No" - -FULL_OPTIMIZATION:remove = "${@'-O2' if bb.data.inherits_class('clang', d) else ''}" -TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" -TARGET_CC_ARCH:remove = "-D_FORTIFY_SOURCE=2" -EXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/" - -SECURITY_STRINGFORMAT:remove = "${@bb.utils.contains('PACKAGECONFIG', 'aws-error-reporter', '-Werror=format-security', '', d)}" - -# GCC-15 uses C23 std and it does not yet compile with C23 -CFLAGS += "-std=gnu17" -# 64bit atomics builtins do not exist in compiler on these arches -LDFLAGS:append:mips = " -latomic" -LDFLAGS:append:powerpc = " -latomic" -LDFLAGS:append:riscv32 = " -latomic" -LDFLAGS:append:riscv64 = " -latomic" -LDFLAGS:append:x86 = " -latomic" - -do_configure:prepend() { - sed -i \ - -e 's#@INIT_MANAGER_IS_SYSTEMD@#'${@'TRUE' if d.getVar('INIT_MANAGER') == 'systemd' else 'FALSE'}'#' \ - -e 's#@INIT_MANAGER_IS_UPSTART@#'${@'TRUE' if d.getVar('INIT_MANAGER') == 'upstart' else 'FALSE'}'#' \ - ${S}/src/CMakeLists.txt -} - -# flex hardcodes the input file in #line directives leading to TMPDIR contamination of debug sources. -do_compile:append() { - find ${B} -name '*.c' -or -name '*.h' | xargs sed -i -e 's|${TMPDIR}|${TARGET_DBGSRC_DIR}/|g' -} - -# needed for shared-lib package config -FILES:${PN} += "${libdir}/fluent-bit" diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_4.2.0.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_4.2.0.bb new file mode 100644 index 0000000000..279486eee3 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit_4.2.0.bb @@ -0,0 +1,150 @@ +SUMMARY = "Fast Log Processor and Forwarder" +DESCRIPTION = "Fluent Bit allows to collect log events or metrics from \ +different sources, process them and deliver them to different backends \ +such as Fluentd, Elasticsearch, Splunk, DataDog, Kafka, New Relic, Azure \ +services, AWS services, Google services, NATS, InfluxDB or any custom \ +HTTP end-point." +HOMEPAGE = "http://fluentbit.io" +BUGTRACKER = "https://github.com/fluent/fluent-bit/issues" +SECTION = "net" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" +DEPENDS = "\ + bison-native \ + flex-native \ + openssl \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ +" +DEPENDS:append:libc-musl = " fts" + +SRCREV = "6bc014390c5485b96521c56b98369b44b9faa08b" +SRC_URI = "\ + git://github.com/fluent/fluent-bit.git;branch=master;protocol=https \ + file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch \ + file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \ + file://0003-CMakeLists.txt-Revise-init-manager-deduction.patch \ +" +SRC_URI:append:libc-musl = "\ + file://0004-chunkio-Link-with-fts-library-with-musl.patch \ +" + +# prefix tag with "v" to avoid upgrade to random tags like "20220215" +UPSTREAM_CHECK_GITTAGREGEX = "v(?P(\d+(\.\d+)+))" + + +PACKAGECONFIG ??= "\ + aws \ + binary \ + config-yaml \ + custom-calyptia \ + http-server \ + inotify \ + ipo \ + metrics \ + parser \ + prefer-system-libs \ + profiles \ + proxy-go \ + record-accessor \ + regex \ + signv4 \ + sqldb \ + stream-processor \ + tls \ + utf8-encoder \ +" +# See https://github.com/fluent/fluent-bit/issues/7248#issuecomment-1631280496 +PACKAGECONFIG:remove:toolchain-clang = "ipo" + +# Use system libs +PACKAGECONFIG[prefer-system-libs] = "-DFLB_PREFER_SYSTEM_LIBS=Yes,-DFLB_PREFER_SYSTEM_LIBS=No, nghttp2 c-ares" +DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs backtrace', 'libbacktrace', '', d)}" +DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs jemalloc', 'jemalloc', '', d)}" +DEPENDS += " ${@bb.utils.contains('PACKAGECONFIG', 'prefer-system-libs luajit', 'luajit', '', d)}" + +PACKAGECONFIG[all] = "-DFLB_ALL=Yes,-DFLB_ALL=No" +PACKAGECONFIG[arrow] = "-DFLB_ARROW=Yes,-DFLB_ARROW=No" +PACKAGECONFIG[avro-encoder] = "-DFLB_AVRO_ENCODER=Yes,-DFLB_AVRO_ENCODER=No" +PACKAGECONFIG[aws-error-reporter] = "-DFLB_AWS_ERROR_REPORTER=Yes,-DFLB_AWS_ERROR_REPORTER=No" +PACKAGECONFIG[aws] = "-DFLB_AWS=Yes,-DFLB_AWS=No" +PACKAGECONFIG[backtrace] = "-DFLB_BACKTRACE=Yes,-DFLB_BACKTRACE=No" +PACKAGECONFIG[binary] = "-DFLB_BINARY=Yes,-DFLB_BINARY=No" +PACKAGECONFIG[chunk-trace] = "-DFLB_CHUNK_TRACE=Yes,-DFLB_CHUNK_TRACE=No" +PACKAGECONFIG[config-yaml] = "-DFLB_CONFIG_YAML=Yes,-DFLB_CONFIG_YAML=No,libyaml" +PACKAGECONFIG[custom-calyptia] = "-DFLB_CUSTOM_CALYPTIA=Yes,-DFLB_CUSTOM_CALYPTIA=No" +PACKAGECONFIG[enforce-alignment] = "-DFLB_ENFORCE_ALIGNMENT=Yes,-DFLB_ENFORCE_ALIGNMENT=No" +PACKAGECONFIG[examples] = "-DFLB_EXAMPLES=Yes,-DFLB_EXAMPLES=No" +PACKAGECONFIG[http-client-debug] = "-DFLB_HTTP_CLIENT_DEBUG=Yes,-DFLB_HTTP_CLIENT_DEBUG=No" +PACKAGECONFIG[http-server] = "-DFLB_HTTP_SERVER=Yes,-DFLB_HTTP_SERVER=No" +PACKAGECONFIG[inotify] = "-DFLB_INOTIFY=Yes,-DFLB_INOTIFY=No" +PACKAGECONFIG[ipo] = "-DFLB_IPO=Yes,-DFLB_IPO=no" +PACKAGECONFIG[jemalloc] = "-DFLB_JEMALLOC=Yes,-DFLB_JEMALLOC=No,jemalloc" +PACKAGECONFIG[luajit] = "-DFLB_LUAJIT=Yes,-DFLB_LUAJIT=No" +PACKAGECONFIG[metrics] = "-DFLB_METRICS=Yes,-DFLB_METRICS=No" +PACKAGECONFIG[mtrace] = "-DFLB_MTRACE=Yes,-DFLB_MTRACE=No" +PACKAGECONFIG[parser] = "-DFLB_PARSER=Yes,-DFLB_PARSER=No" +PACKAGECONFIG[posix-tls] = "-DFLB_POSIX_TLS=Yes,-DFLB_POSIX_TLS=No" +PACKAGECONFIG[profiles] = "-DFLB_PROFILES=Yes,-DFLB_PROFILES=No" +PACKAGECONFIG[proxy-go] = "-DFLB_PROXY_GO=Yes,-DFLB_PROXY_GO=No" +PACKAGECONFIG[record-accessor] = "-DFLB_RECORD_ACCESSOR=Yes,-DFLB_RECORD_ACCESSOR=No" +PACKAGECONFIG[regex] = "-DFLB_REGEX=Yes,-DFLB_REGEX=No" +PACKAGECONFIG[run-ldconfig] = "-DFLB_RUN_LDCONFIG=Yes,-DFLB_RUN_LDCONFIG=No" +PACKAGECONFIG[shared-lib] = "-DFLB_SHARED_LIB=Yes,-DFLB_SHARED_LIB=No" +PACKAGECONFIG[signv4] = "-DFLB_SIGNV4=Yes,-DFLB_SIGNV4=No" +PACKAGECONFIG[sqldb] = "-DFLB_SQLDB=Yes,-DFLB_SQLDB=No" +PACKAGECONFIG[stream-processor] = "-DFLB_STREAM_PROCESSOR=Yes,-DFLB_STREAM_PROCESSOR=No" +PACKAGECONFIG[tests-runtime] = "-DFLB_TESTS_RUNTIME=Yes,-DFLB_TESTS_RUNTIME=No" +PACKAGECONFIG[tls] = "-DFLB_TLS=Yes,-DFLB_TLS=No" +PACKAGECONFIG[trace] = "-DFLB_TRACE=Yes,-DFLB_TRACE=No" +PACKAGECONFIG[utf8-encoder] = "-DFLB_UTF8_ENCODER=Yes,-DFLB_UTF8_ENCODER=No" +PACKAGECONFIG[valgrind] = "-DFLB_VALGRIND=Yes,-DFLB_VALGRIND=No,valgrind" +PACKAGECONFIG[wamrc] = "-DFLB_WAMRC=Yes,-DFLB_WAMRC=No" +PACKAGECONFIG[wasm-stack-protect] = "-DFLB_WASM_STACK_PROTECT=Yes,-DFLB_WASM_STACK_PROTECT=No" +PACKAGECONFIG[wasm] = "-DFLB_WASM=Yes,-DFLB_WASM=No" +PACKAGECONFIG[windows-defaults] = "-DFLB_WINDOWS_DEFAULTS=Yes,-DFLB_WINDOWS_DEFAULTS=No" + +# Option to disable all Fluent Bit plugins by default. See cmake/plugins_options.cmake which +# individual plugins then to enable (e.g. using EXTRA_OECMAKE:append = " -DFLB_FOOBAR=ON") +PACKAGECONFIG[minimal] = "-DFLB_MINIMAL=Yes,-DFLB_MINIMAL=No" + +PACKAGECONFIG[in-kafka] = "-DFLB_KAFKA=ON -DFLB_IN_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_IN_KAFKA=OFF,librdkafka curl" +PACKAGECONFIG[out-kafka] = "-DFLB_KAFKA=ON -DFLB_OUT_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_OUT_KAFKA=OFF,librdkafka curl" + +SYSTEMD_SERVICE:${PN} = "fluent-bit.service" + +inherit cmake systemd pkgconfig + +# disable manipulation of compiler flags and CMAKE_BUILD_TYPE +# release and coverage are off by default, disable also debug +EXTRA_OECMAKE += "-DFLB_DEBUG=No" + +FULL_OPTIMIZATION:remove = "${@'-O2' if bb.data.inherits_class('clang', d) else ''}" +TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH:remove = "-D_FORTIFY_SOURCE=2" +EXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/" + +SECURITY_STRINGFORMAT:remove = "${@bb.utils.contains('PACKAGECONFIG', 'aws-error-reporter', '-Werror=format-security', '', d)}" + +# GCC-15 uses C23 std and it does not yet compile with C23 +CFLAGS += "-std=gnu17" +# 64bit atomics builtins do not exist in compiler on these arches +LDFLAGS:append:mips = " -latomic" +LDFLAGS:append:powerpc = " -latomic" +LDFLAGS:append:riscv32 = " -latomic" +LDFLAGS:append:riscv64 = " -latomic" +LDFLAGS:append:x86 = " -latomic" + +do_configure:prepend() { + sed -i \ + -e 's#@INIT_MANAGER_IS_SYSTEMD@#'${@'TRUE' if d.getVar('INIT_MANAGER') == 'systemd' else 'FALSE'}'#' \ + -e 's#@INIT_MANAGER_IS_UPSTART@#'${@'TRUE' if d.getVar('INIT_MANAGER') == 'upstart' else 'FALSE'}'#' \ + ${S}/src/CMakeLists.txt +} + +# flex hardcodes the input file in #line directives leading to TMPDIR contamination of debug sources. +do_compile:append() { + find ${B} -name '*.c' -or -name '*.h' | xargs sed -i -e 's|${TMPDIR}|${TARGET_DBGSRC_DIR}/|g' +} + +# needed for shared-lib package config +FILES:${PN} += "${libdir}/fluent-bit" -- cgit v1.2.3-54-g00ecf