File fluent-bit.spec of Package fluent-bit
#
# spec file for package fluent-bit
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _distconfdir /usr/etc
Name: fluent-bit
Version: 3.0.0
Release: 0
Summary: Fast data collector for Linux
License: Apache-2.0
Group: System/Daemons
URL: https://fluentbit.io/
Source0: https://github.com/fluent/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: fluent-bit.service
BuildRequires: git
BuildRequires: libedit-devel
BuildRequires: libopenssl-devel
BuildRequires: libyaml-devel
BuildRequires: postgresql14-devel
BuildRequires: systemd-devel
# BuildRequires: msgpack-devel # TODO unresolvable in SLES builder on OBS?
# BuildRequires: valgrind-devel # TODO unresolvable in SLES builder on OBS?
BuildRequires: gcc-c++
BuildRequires: bison
BuildRequires: cmake
BuildRequires: flex
%description
Fluent Bit is a high performance and multi platform Log Forwarder.
%prep
%setup -q -n %{name}-%{version}
%build
##
## build ####################################################
##
%cmake \
-DFLB_ALL=On\
-DFLB_SHARED_LIB=Off\
-DFLB_WASM_STACK_PROTECT=On\
-DFLB_RELEASE=On
#
# - build fluent-bit
#
%make_build
%install
##
## install ##################################################
##
#
cd build
%make_install
#
install -d -m755 %{buildroot}%{_bindir}/
install -d -m755 %{buildroot}%{_sysconfdir}/%{name}
install -d -m755 %{buildroot}%{_unitdir}
install -c -m644 %{SOURCE1} %{buildroot}%{_unitdir}/fluent-bit.service
install -D -m 0644 %{buildroot}%{_distconfdir}/%{name}/fluent-bit.conf %{buildroot}/etc/%{name}/fluent-bit.conf
install -D -m 0644 %{buildroot}%{_distconfdir}/%{name}/parsers.conf %{buildroot}/etc/%{name}/parsers.conf
install -D -m 0644 %{buildroot}%{_distconfdir}/%{name}/plugins.conf %{buildroot}/etc/%{name}/plugins.conf
install -d -m755 %{buildroot}%{_sbindir}/
pushd %{buildroot}%{_sbindir}
ln -s service rc%{name}
popd
# remove unnecessary "Installed (but unpackaged) file(s)"
rm %{buildroot}%{_bindir}/luajit
rm -rf %{buildroot}/usr/include
rm -rf %{buildroot}/usr/lib/debug
rm %{buildroot}%{_libdir}/libluajit.a
rm %{buildroot}%{_distconfdir}/%{name}/%{name}.conf
rm %{buildroot}%{_distconfdir}/%{name}/parsers.conf
rm %{buildroot}%{_distconfdir}/%{name}/plugins.conf
%if 0%{?suse_version} > 1500
rm %{buildroot}/lib/systemd/system/fluent-bit.service
%endif
%preun
%service_del_preun fluent-bit.service
%postun
%service_del_postun fluent-bit.service
%pre
%service_add_pre fluent-bit.service
%post
%service_add_post fluent-bit.service
%files
##
## file list ################################################
##
%defattr(-,root,root,-)
%{_sbindir}/rcfluent-bit
%{_bindir}/fluent-bit
%{_unitdir}/fluent-bit.service
%{_sysconfdir}/fluent-bit
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}/parsers.conf
%config(noreplace) %{_sysconfdir}/%{name}/plugins.conf
%changelog