Skip to content

Commit

Permalink
conf: use a custom flb-2.1.3 fork to not require root (#235)
Browse files Browse the repository at this point in the history
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
  • Loading branch information
Minipada authored Jun 14, 2023
1 parent 85c07a3 commit 50336c9
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 49 deletions.
4 changes: 2 additions & 2 deletions fluent_bit_plugins/src/c/in_ros2.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ void data_callback(const void* msgin)
char* pack;
ctx->buf = msg->data.data;
ctx->buf_len = msg->data.capacity;
flb_debug("buf_len: %ld, buf: '%s'", ctx->buf_len, ctx->buf);
flb_debug("buf_len: %d, buf: '%s'", ctx->buf_len, ctx->buf);

int ret = flb_pack_json(ctx->buf, ctx->buf_len, &pack, &pack_size, &root_type);
int ret = flb_pack_json(ctx->buf, ctx->buf_len, &pack, &pack_size, &root_type, NULL);
if (ret == FLB_ERR_JSON_PART)
{
flb_warn("Data incomplete, waiting for more...");
Expand Down
167 changes: 120 additions & 47 deletions fluent_bit_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.5)
project(fluent_bit_vendor)

find_package(ament_cmake REQUIRED)
find_package(dc_interfaces REQUIRED)

set(cmake_commands)
set(cmake_configure_args -Wno-dev)
Expand Down Expand Up @@ -56,10 +55,10 @@ else()
endif()
set(fluent_bit_external_project_dir ${CMAKE_CURRENT_BINARY_DIR}/fluent_bit)
include(ExternalProject)
set(fluent_bit_version "1ab360f79c73627a0789551287c074aa2016bf26")
# message(${CMAKE_CURRENT_LIST_DIR})
set(fluent_bit_version "fix-2.1.3")

ExternalProject_Add(fluent_bit_src
GIT_REPOSITORY https://github.com/fluent/fluent-bit
GIT_REPOSITORY https://github.com/minipada/fluent-bit
GIT_TAG ${fluent_bit_version}
GIT_CONFIG advice.detachedHead=false
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/mpack.patch
Expand All @@ -76,59 +75,133 @@ ExternalProject_Add(fluent_bit_src
-DFLB_OUT_PGSQL=On
-DFLB_SHARED_LIB=On
-DFLB_PROXY_GO=On
-DSYSTEMD_UNITDIR=${fluent_bit_external_project_dir}/install/system
${cmake_configure_args}
)

externalproject_get_property(fluent_bit_src INSTALL_DIR)
set(fluent_bit_INCLUDE_DIR "${INSTALL_DIR}/../fluent_bit/install/include")
set(fluent_bit_INCLUDE_DIR "${INSTALL_DIR}/../fluent_bit/install/include/")
set(fluent_bit_LIB_DIR "${INSTALL_DIR}/../fluent_bit/install/lib/fluent-bit")

set(FB_SRC_LIB_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/lib")

set(ares_INCLUDE_FILES
"${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares.h"
"${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_build.h"
"${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_rules.h"
"${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_version.h"
)
set(cfl_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/include/cfl")
set(cmetrics_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/cmetrics")
set(ctraces_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/ctraces/include/ctraces")
set(jsmn_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/jsmn")
set(mkcore_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/monkey/include/monkey/mk_core")
set(mpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/mpack-amalgamation-1.1/src/mpack")
set(msgpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack")
set(msgpack_INCLUDE_FILES
"${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack.h"
)
set(prometheus_remote_write_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/prometheus_remote_write")
set(xxhash_INCLUDE_FILES
"${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/xxhash.h"
"${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/xxh3.h"
)
set(FB_SRC_LIB_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/lib")
set(FB_SRC_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/include/fluent-bit")

install(DIRECTORY ${fluent_bit_INCLUDE_DIR}/ DESTINATION include)
install(FILES ${ares_INCLUDE_FILES} DESTINATION include)
install(DIRECTORY ${cfl_INCLUDE_DIR}/ DESTINATION include/cfl)
install(DIRECTORY ${cmetrics_INCLUDE_DIR}/ DESTINATION include/cmetrics)
install(DIRECTORY ${ctraces_INCLUDE_DIR}/ DESTINATION include/ctraces)
install(DIRECTORY ${jsmn_INCLUDE_DIR}/ DESTINATION include/jsmn)
install(DIRECTORY ${mkcore_INCLUDE_DIR}/ DESTINATION include/mk_core)
install(DIRECTORY ${mpack_INCLUDE_DIR}/ DESTINATION include/mpack)
install(DIRECTORY ${msgpack_INCLUDE_DIR}/ DESTINATION include/msgpack)
install(FILES ${msgpack_INCLUDE_FILES} DESTINATION include)
install(DIRECTORY ${prometheus_remote_write_INCLUDE_DIR}/ DESTINATION include/prometheus_remote_write)
install(FILES ${xxhash_INCLUDE_FILES}/ DESTINATION include)
set(ares_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.19.0/include/")
set(cfl_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/include/cfl/")
set(config_format_INCLUDE_DIR "${FB_SRC_INCLUDE_DIR}/config_format/")
set(cmetrics_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/cmetrics/")
set(ctraces_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/ctraces/include/ctraces/")
set(jsmn_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/jsmn/")
set(mkcore_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/monkey/include/monkey/mk_core/")
set(mpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/mpack-amalgamation-1.1/src/mpack/")
set(msgpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack/")
set(msgpack_INCLUDE_FILES "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack.h")
set(prometheus_remote_write_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/prometheus_remote_write/")
set(xxhash_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/")

install(FILES ${fluent_bit_LIB_DIR}/libfluent-bit.so DESTINATION lib)
install(FILES ${INSTALL_DIR}/src/fluent_bit_src/library/libmsgpack-c-static.a DESTINATION lib)
install(FILES ${INSTALL_DIR}/src/fluent_bit_src/library/libfluent-bit.a DESTINATION lib)

install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME})
install(
DIRECTORY
${fluent_bit_INCLUDE_DIR}
${ares_INCLUDE_DIR}
DESTINATION
include
)

install(
DIRECTORY ${INSTALL_DIR}/src/fluent_bit_src/cmake
DESTINATION share/${PROJECT_NAME}
DIRECTORY
${cfl_INCLUDE_DIR}
DESTINATION
include/cfl
)
install(
DIRECTORY
${config_format_INCLUDE_DIR}
DESTINATION
include/config_format
)
install(
DIRECTORY
${cmetrics_INCLUDE_DIR}
DESTINATION
include/cmetrics
)
install(
DIRECTORY
${ctraces_INCLUDE_DIR}
DESTINATION
include/ctraces
)
install(
DIRECTORY
${jsmn_INCLUDE_DIR}
DESTINATION
include/jsmn
)
install(
DIRECTORY
${mkcore_INCLUDE_DIR}
DESTINATION
include/mk_core
)
install(
DIRECTORY
${mpack_INCLUDE_DIR}
DESTINATION
include/mpack
)
install(
DIRECTORY
${msgpack_INCLUDE_DIR}
DESTINATION
include/msgpack
)
install(
FILES
${msgpack_INCLUDE_FILES}
DESTINATION
include
)
install(
DIRECTORY
${prometheus_remote_write_INCLUDE_DIR}
DESTINATION
include/prometheus_remote_write
)
install(
DIRECTORY
${xxhash_INCLUDE_DIR}
DESTINATION
include
)
install(
FILES
${fluent_bit_LIB_DIR}/libfluent-bit.so
DESTINATION
lib
)
install(
FILES
${INSTALL_DIR}/src/fluent_bit_src/library/libmsgpack-c-static.a
DESTINATION
lib
)
install(
FILES
${INSTALL_DIR}/src/fluent_bit_src/library/libfluent-bit.a
DESTINATION
lib
)
install(
DIRECTORY
cmake
DESTINATION
share/${PROJECT_NAME}
)
install(
DIRECTORY
${INSTALL_DIR}/src/fluent_bit_src/cmake
DESTINATION
share/${PROJECT_NAME}
)

ament_export_include_directories(include)
Expand Down

0 comments on commit 50336c9

Please sign in to comment.