app-admin/fluent-bit: Upgrade fluent-bit to v3.0.6

BUG=b/346306142
TEST=Emerge-lakitu
RELEASE_NOTE=Upgrade fluent-bit from v1.9.4 to v3.0.6.

Change-Id: I4178370d83e97ff87434ff1907f6cff3eac3024e
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/75254
Reviewed-by: Kevin Berry <kpberry@google.com>
Tested-by: RBE-prod-presubmit <service-269995278450@remotebuildexecution.iam.gserviceaccount.com>
diff --git a/project-lakitu/app-admin/fluent-bit/Manifest b/project-lakitu/app-admin/fluent-bit/Manifest
index 9a44679..e21fa2f 100644
--- a/project-lakitu/app-admin/fluent-bit/Manifest
+++ b/project-lakitu/app-admin/fluent-bit/Manifest
@@ -1 +1 @@
-DIST fluent-bit-1.9.4.tar.gz 19223914 BLAKE2B ac4ab72dfe5e97eae5a37300b729433e9a03ef2795aad4d970f79f4c5a2f6b1f93bdaf5646313a0402004ff1a65609f93e43c897ce44b9bc9b1f31a27d3b6e81 SHA512 ffcfbdb2914ae67250eb345fa862ea81fc77e25736b697a044d2ce437be3a469462c9d0f70c4a927cb9256e02374ee70a02312443da3da5147d6db8aacc233d9
+DIST fluent-bit-3.0.6.tar.gz 27030192 BLAKE2B e7e1da530551392668862452db5a60d723a9ec2c03694f072779e1d1eef0a32713158dee33247167101430c8f69dd0805a8cbc8cbd9451bb09c66ccdfc1d5ca4 SHA512 79b01bb4aa06b90d2581688ec9c940c7dacd395c6ef085fd61a8ad11dd07fcb1998961cbde115cdbe3d3b1c80259fbf8162b167910a01c583758292d37ffe9ed
diff --git a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-cross-compile.patch b/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-cross-compile.patch
deleted file mode 100644
index cf29e0d..0000000
--- a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-cross-compile.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From dd0a55ea479a4ffb3839e1a0348fc6ae4588c449 Mon Sep 17 00:00:00 2001
-From: Ke Wu <mikewu@google.com>
-Date: Tue, 19 Jul 2022 13:41:49 -0700
-Subject: [PATCH] Add cross-compiling to fluent-bit
-
----
- CMakeLists.txt                        | 4 ++--
- cmake/luajit.cmake                    | 2 +-
- cmake/onigmo.cmake                    | 4 ++--
- lib/luajit-2.1.0-1e66d0f/src/Makefile | 4 +++-
- lib/onigmo/configure                  | 6 ++++--
- 5 files changed, 12 insertions(+), 8 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index ed3d0cea0..3d837c500 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -799,7 +799,7 @@ if(FLB_JEMALLOC AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-   # Link to Jemalloc as an external dependency
-   ExternalProject_Add(jemalloc
-     SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1
--    CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} "${FLB_JEMALLOC_OPTIONS_LIST}" --prefix=<INSTALL_DIR>
-+    CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} --host=${HOST} "${FLB_JEMALLOC_OPTIONS_LIST}" --prefix=<INSTALL_DIR>
-     CFLAGS=-std=gnu99\ -Wall\ -pipe\ -g3\ -O3\ -funroll-loops
-     BUILD_COMMAND $(MAKE)
-     INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/
-@@ -825,7 +825,7 @@ if(FLB_BACKTRACE)
-   endif()
-   ExternalProject_Add(backtrace
-     SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbacktrace-2446c66/
--    CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbacktrace-2446c66/configure ${AUTOCONF_HOST_OPT} --prefix=<INSTALL_DIR> --enable-shared=no --enable-static=yes
-+    CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbacktrace-2446c66/configure ${AUTOCONF_HOST_OPT} --host=${HOST} --prefix=<INSTALL_DIR> --enable-shared=no --enable-static=yes
-     BUILD_COMMAND $(MAKE)
-     INSTALL_COMMAND $(MAKE) DESTDIR= install
-     )
-diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
-index 7741805a9..3984e84d3 100644
---- a/cmake/luajit.cmake
-+++ b/cmake/luajit.cmake
-@@ -37,7 +37,7 @@ ExternalProject_Add(luajit
-   EXCLUDE_FROM_ALL TRUE
-   SOURCE_DIR ${LUAJIT_SRC}
-   CONFIGURE_COMMAND ./configure
--  BUILD_COMMAND $(MAKE) CC=${CMAKE_C_COMPILER} ${DEPLOYMENT_TARGET} CFLAGS=${CFLAGS} BUILDMODE=static "XCFLAGS=-fPIC"
-+  BUILD_COMMAND $(MAKE) CC=${CC} CROSS=${CROSS_PREFIX} HOST_CC=${BUILD_CC} STRIP=${STRIP} ${DEPLOYMENT_TARGET} CFLAGS=${CFLAGS} BUILDMODE=static "XCFLAGS=-fPIC"
-   INSTALL_COMMAND cp src/libluajit.a "${LUAJIT_DEST}/lib/libluajit.a")
- 
- # luajit (Windows)
-diff --git a/cmake/onigmo.cmake b/cmake/onigmo.cmake
-index dd9cb3119..d38f526fe 100644
---- a/cmake/onigmo.cmake
-+++ b/cmake/onigmo.cmake
-@@ -33,7 +33,7 @@ ExternalProject_Add(onigmo
-   EXCLUDE_FROM_ALL TRUE
-   SOURCE_DIR ${ONIGMO_SRC}
-   INSTALL_DIR ${ONIGMO_DEST}
--  CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
-+  CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --host=${HOST} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
-   CFLAGS=-std=gnu99\ -Wall\ -pipe\ -Os\ -g0\ -s\ -fno-stack-protector\ -fomit-frame-pointer\ -DNDEBUG\ -U_FORTIFY_SOURCE
-   BUILD_COMMAND $(MAKE)
-   INSTALL_COMMAND $(MAKE) DESTDIR= install)
-@@ -43,7 +43,7 @@ ExternalProject_Add(onigmo
-   EXCLUDE_FROM_ALL TRUE
-   SOURCE_DIR ${ONIGMO_SRC}
-   INSTALL_DIR ${ONIGMO_DEST}
--  CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
-+  CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --host=${HOST} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
-   CFLAGS=-std=gnu99\ -Wall\ -pipe\ -g3\ -O3\ -funroll-loops
-   BUILD_COMMAND $(MAKE)
-   INSTALL_COMMAND $(MAKE) DESTDIR= install)
-diff --git a/lib/luajit-2.1.0-1e66d0f/src/Makefile b/lib/luajit-2.1.0-1e66d0f/src/Makefile
-index 2e1a28885..952885414 100644
---- a/lib/luajit-2.1.0-1e66d0f/src/Makefile
-+++ b/lib/luajit-2.1.0-1e66d0f/src/Makefile
-@@ -212,7 +212,8 @@ TARGET_STCC= $(STATIC_CC)
- TARGET_DYNCC= $(DYNAMIC_CC)
- TARGET_LD= $(CROSS)$(CC)
- TARGET_AR= $(CROSS)ar rcus 2>/dev/null
--TARGET_STRIP= $(CROSS)strip
-+# lakitu: Use STRIP env to allow llvm-strip
-+TARGET_STRIP= $(CROSS)$(STRIP)
- 
- TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
- TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
-@@ -700,6 +701,7 @@ include Makefile.dep
- # Target file rules.
- ##############################################################################
- 
-+
- $(LUAJIT_A): $(LJVMCORE_O)
- 	$(E) "AR        $@"
- 	$(Q)$(TARGET_AR) $@ $(LJVMCORE_O)
-diff --git a/lib/onigmo/configure b/lib/onigmo/configure
-index 23b88c43e..561e5865f 100755
---- a/lib/onigmo/configure
-+++ b/lib/onigmo/configure
-@@ -12111,7 +12111,8 @@ then
-   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
-   if test "x$CC" != xcc; then
-     # Test first that cc exists at all.
--    if { ac_try='cc -c conftest.$ac_ext >&5'
-+    # lakitu: cros_sdk doesn't allow to use unprefixed cc directly.
-+    if { ac_try='$CC -c conftest.$ac_ext >&5'
-   { { case "(($ac_try" in
-   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-   *) ac_try_echo=$ac_try;;
-@@ -12122,7 +12123,8 @@ $as_echo "$ac_try_echo"; } >&5
-   ac_status=$?
-   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-   test $ac_status = 0; }; }; then
--      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-+      # lakitu: cros_sdk doesn't allow to use unprefixed cc directly.
-+      ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-       rm -f conftest2.*
-       if { { case "(($ac_try" in
-   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
--- 
-2.37.0.170.g444d1eabd0-goog
-
diff --git a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-wdocumentation.patch b/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-wdocumentation.patch
deleted file mode 100644
index ba04f68..0000000
--- a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-1.9.4-wdocumentation.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -r -Naur a/lib/mbedtls-2.28.0/library/CMakeLists.txt b/lib/mbedtls-2.28.0/library/CMakeLists.txt
---- a/lib/mbedtls-2.28.0/library/CMakeLists.txt	2023-07-07 02:03:28.000000000 -0700
-+++ b/lib/mbedtls-2.28.0/library/CMakeLists.txt	2023-07-07 12:44:32.348180846 -0700
-@@ -122,7 +122,7 @@
- endif(CMAKE_COMPILER_IS_GNUCC)
- 
- if(CMAKE_COMPILER_IS_CLANG)
--    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code")
-+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes -Wno-documentation-deprecated-sync -Wunreachable-code")
- endif(CMAKE_COMPILER_IS_CLANG)
- 
- if(WIN32)
-diff -r -Naur a/lib/mbedtls-2.28.0/tests/CMakeLists.txt b/lib/mbedtls-2.28.0/tests/CMakeLists.txt
---- a/lib/mbedtls-2.28.0/tests/CMakeLists.txt	2023-07-07 02:03:28.000000000 -0700
-+++ b/lib/mbedtls-2.28.0/tests/CMakeLists.txt	2023-07-07 12:44:42.096881643 -0700
-@@ -68,7 +68,7 @@
- endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
- 
- if(CMAKE_COMPILER_IS_CLANG)
--    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code")
-+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-documentation-deprecated-sync -Wunreachable-code")
- endif(CMAKE_COMPILER_IS_CLANG)
- 
- if(MSVC)
diff --git a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-2.2.0-stackdriver-workers.patch b/project-lakitu/app-admin/fluent-bit/files/fluent-bit-2.2.0-stackdriver-workers.patch
deleted file mode 100644
index 2add0d0..0000000
--- a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-2.2.0-stackdriver-workers.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 95b149152dfaf2938af935fbb94a6589fef45d26 Mon Sep 17 00:00:00 2001
-From: michael
- <kochera@fluent-bit-repro.us-central1-a.c.cloud-kernel-build.internal>
-Date: Mon, 3 Jun 2024 09:43:16 +0000
-Subject: [PATCH] Fix stackdriver pluging crashing with SIGABRT
-
-This changes the default workers for the stackdriver pluging from 2 to 1.
----
- plugins/out_stackdriver/stackdriver.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/plugins/out_stackdriver/stackdriver.c b/plugins/out_stackdriver/stackdriver.c
-index e3654dfdb..0a90d6482 100644
---- a/plugins/out_stackdriver/stackdriver.c
-+++ b/plugins/out_stackdriver/stackdriver.c
-@@ -2548,7 +2548,7 @@ struct flb_output_plugin out_stackdriver_plugin = {
-     .cb_init      = cb_stackdriver_init,
-     .cb_flush     = cb_stackdriver_flush,
-     .cb_exit      = cb_stackdriver_exit,
--    .workers      = 2,
-+    .workers      = 1,
-     .config_map   = config_map,
- 
-     /* Test */
--- 
-2.25.1
diff --git a/project-lakitu/app-admin/fluent-bit/files/fluent-bit-3.0.6-cross-compile.patch b/project-lakitu/app-admin/fluent-bit/files/fluent-bit-3.0.6-cross-compile.patch
new file mode 100644
index 0000000..770ae88
--- /dev/null
+++ b/project-lakitu/app-admin/fluent-bit/files/fluent-bit-3.0.6-cross-compile.patch
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1d8272754..3dcd3aea5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -843,8 +843,8 @@ if(FLB_CONFIG_YAML)
+     set(FLB_HAVE_LIBYAML 1)
+     FLB_DEFINITION(FLB_HAVE_LIBYAML)
+     # For non-standard libyaml installation paths such as homebrew bottled libyaml.
+-    include_directories(${LIBYAML_INCLUDEDIR})
+-    link_directories(${LIBYAML_LIBRARY_DIRS})
++    include_directories("$ENV{SYSROOT}/${LIBYAML_INCLUDEDIR}")
++    link_directories("$ENV{SYSROOT}/${LIBYAML_LIBRARY_DIRS}")
+   else()
+     if (FLB_LIBYAML_DIR)
+       set(LIBYAML_LIBRARY_DIRS "${FLB_LIBYAML_DIR}/lib")
diff --git a/project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4-r7.ebuild b/project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4-r7.ebuild
deleted file mode 120000
index 4acaea9..0000000
--- a/project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4-r7.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-fluent-bit-1.9.4.ebuild
\ No newline at end of file
diff --git a/project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6-r1.ebuild b/project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6-r1.ebuild
new file mode 120000
index 0000000..232c1d5
--- /dev/null
+++ b/project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6-r1.ebuild
@@ -0,0 +1 @@
+fluent-bit-3.0.6.ebuild
\ No newline at end of file
diff --git a/project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4.ebuild b/project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6.ebuild
similarity index 79%
rename from project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4.ebuild
rename to project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6.ebuild
index b8ae2f4..770455b 100644
--- a/project-lakitu/app-admin/fluent-bit/fluent-bit-1.9.4.ebuild
+++ b/project-lakitu/app-admin/fluent-bit/fluent-bit-3.0.6.ebuild
@@ -33,6 +33,7 @@
 
 DEPEND=""
 RDEPEND="${DEPEND}
+	dev-libs/libyaml
 	sys-apps/systemd
 "
 
@@ -40,9 +41,7 @@
 BUILDDIR="${WORKDIR}"/"${P}"_build
 
 PATCHES=(
-	"${FILESDIR}/fluent-bit-1.9.4-cross-compile.patch"
-	"${FILESDIR}/fluent-bit-1.9.4-wdocumentation.patch"
-	"${FILESDIR}/fluent-bit-2.2.0-stackdriver-workers.patch"
+	"${FILESDIR}/fluent-bit-3.0.6-cross-compile.patch"
 )
 
 src_prepare() {
@@ -50,16 +49,12 @@
 }
 
 src_configure() {
-	tc-export CC BUILD_CC STRIP
 	local mycmakeargs=(
 		-DCMAKE_SYSTEM_NAME=Linux
-		# Required by jemalloc, libbacktrace and onigmo.
-		-DHOST="${CHOST}"
-		# Required by luajit
-		-DCC="${CC}"
-		-DBUILD_CC="${BUILD_CC}"
-		-DSTRIP="${STRIP}"
-		-DCROSS_PREFIX=/usr/bin/
+		-DGNU_HOST="${CHOST}"
+		-DFLB_WASM=Off
+		-DFLB_LUAJIT=Off
+		-DFLB_EXAMPLES=Off
 	)
 	cmake_src_configure
 }
@@ -70,7 +65,6 @@
 
 src_install() {
 	dobin "${BUILDDIR}"/bin/fluent-bit
-	dolib.so "${BUILDDIR}"/lib/libfluent-bit.so
 
 	# The default fluent-bit config for stackdriver logging.
 	insinto /etc/fluent-bit