package/fluent-bit: add support for non glibc toolchain

- require threads and dynamic library support
- require sync_4 support
- provide fts.h through musl-fts

static_assert is not available if no C++ toolchain or no glibc
is used, so add two patches to fix this

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Thomas Devoogdt 2023-02-11 19:25:44 +01:00 committed by Peter Korsgaard
parent 656af31891
commit d649bcd380
4 changed files with 105 additions and 5 deletions

View File

@ -0,0 +1,33 @@
From e4f825dd9e952f4a056bf89342049e67102ae6bb Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas.devoogdt@barco.com>
Date: Wed, 1 Feb 2023 11:38:15 +0100
Subject: [PATCH] lib: cfl: fixup static_assert
"undefined reference to 'static_assert'"
Not defined when using uClibc or if not C++ >= 11.
upstream: https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
---
lib/cfl/lib/xxhash/xxhash.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/cfl/lib/xxhash/xxhash.h b/lib/cfl/lib/xxhash/xxhash.h
index 08ab79457..511c4d12b 100644
--- a/lib/cfl/lib/xxhash/xxhash.h
+++ b/lib/cfl/lib/xxhash/xxhash.h
@@ -1546,8 +1546,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
/* note: use after variable declarations */
#ifndef XXH_STATIC_ASSERT
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
-# include <assert.h>
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
+# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0)
# elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
# else
--
2.34.1

View File

@ -0,0 +1,56 @@
From f55f9bf6d9201169d2e5d3782068b03ff17dec90 Mon Sep 17 00:00:00 2001
From: Thomas Devoogdt <thomas.devoogdt@barco.com>
Date: Wed, 1 Feb 2023 11:26:56 +0100
Subject: [PATCH] lib: c-ares: fixup static_assert
"undefined reference to 'static_assert'"
Not defined when using uClibc or if not C++ >= 11.
upstream: https://github.com/c-ares/c-ares/issues/504
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
---
lib/c-ares-1.19.0/configure | 4 ++++
lib/c-ares-1.19.0/m4/ax_cxx_compile_stdcxx_11.m4 | 3 +++
2 files changed, 7 insertions(+)
diff --git a/lib/c-ares-1.19.0/configure b/lib/c-ares-1.19.0/configure
index 4c5e1a966..58712ec34 100755
--- a/lib/c-ares-1.19.0/configure
+++ b/lib/c-ares-1.19.0/configure
@@ -6317,6 +6317,8 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#define static_assert _Static_assert
+
template <typename T>
struct check
{
@@ -6394,6 +6396,8 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#define static_assert _Static_assert
+
template <typename T>
struct check
{
diff --git a/lib/c-ares-1.19.0/m4/ax_cxx_compile_stdcxx_11.m4 b/lib/c-ares-1.19.0/m4/ax_cxx_compile_stdcxx_11.m4
index 229de3091..fe4a11c67 100644
--- a/lib/c-ares-1.19.0/m4/ax_cxx_compile_stdcxx_11.m4
+++ b/lib/c-ares-1.19.0/m4/ax_cxx_compile_stdcxx_11.m4
@@ -37,6 +37,9 @@
#serial 9
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
+
+#define static_assert _Static_assert
+
template <typename T>
struct check
{
--
2.34.1

View File

@ -1,6 +1,9 @@
config BR2_PACKAGE_FLUENT_BIT
bool "fluent-bit"
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_STATIC_LIBS # dlfcn.h
select BR2_PACKAGE_MUSL_FTS if !BR2_TOOLCHAIN_USES_GLIBC
select BR2_PACKAGE_OPENSSL
select BR2_PACKAGE_LIBYAML
help
@ -29,5 +32,6 @@ config BR2_PACKAGE_FLUENT_BIT_WASM
endif
comment "fluent-bit needs a glibc toolchain"
depends on !BR2_TOOLCHAIN_USES_GLIBC
comment "fluent-bit needs a toolchain w/ threads, dynamic library"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS

View File

@ -49,12 +49,19 @@ FLUENT_BIT_CONF_OPTS += \
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS"
ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
FLUENT_BIT_DEPENDENCIES += musl-fts
FLUENT_BIT_LDFLAGS += -lfts
endif
# Uses __atomic_compare_exchange_8
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
FLUENT_BIT_CONF_OPTS += \
-DCMAKE_EXE_LINKER_FLAGS=-latomic
FLUENT_BIT_LDFLAGS += -latomic
endif
FLUENT_BIT_CONF_OPTS += \
-DCMAKE_EXE_LINKER_FLAGS="$(FLUENT_BIT_LDFLAGS)"
define FLUENT_BIT_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/fluent-bit/S99fluent-bit \
$(TARGET_DIR)/etc/init.d/S99fluent-bit