blob: abe1266c72b5495594c7a7de49f8f78de4b6a776 [file] [log] [blame]
#
# Copyright 2022 Google LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
EAPI=7
# Use emake instead of Ninja as MAKEFILE generator because Ninja will fail
# with the following error:
# ninja: error: build.ninja:67: bad $-escape (literal $ must be written as $$)
# FLAGS = -Wall -D__FILENAME__='"$(subst /tmp/fluent-bit/,,$(abspath $<)...
CMAKE_MAKEFILE_GENERATOR=emake
inherit cmake toolchain-funcs systemd
DESCRIPTION="Logging agent"
HOMEPAGE="https://fluentbit.io/"
SRC_URI="https://github.com/fluent/fluent-bit/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="*"
DEPEND=""
RDEPEND="${DEPEND}
sys-apps/systemd
!app-admin/stackdriver
"
S="${WORKDIR}"/"${P}"
BUILDDIR="${WORKDIR}"/"${P}"_build
PATCHES=(
"${FILESDIR}/fluent-bit-1.9.4-cross-compile.patch"
)
src_prepare() {
cmake_src_prepare
}
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/
)
cmake_src_configure
}
src_compile() {
cmake_src_compile
}
src_install() {
dobin "${BUILDDIR}"/bin/fluent-bit
dolib.so "${BUILDDIR}"/lib/libfluent-bit.so
# Make conf file immutable.
insinto /usr/share/fluent-bit
doins "${FILESDIR}"/fluent-bit.conf
doins "${FILESDIR}"/parsers.conf
systemd_dounit "${FILESDIR}"/fluent-bit.service
systemd_dounit "${FILESDIR}"/docker-events-collector.service
systemd_dounit "${FILESDIR}"/logging-agent.target
}