File ananicy-cpp.spec of Package ananicy-cpp
#
# spec file for package ananicy-cpp
#
# Copyright (c) 2024 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/
#
%bcond_with bpf
%global ananicy_service %name.service
Name: ananicy-cpp
Version: 1.1.1
Release: 0
Summary: Another auto nice daemon, rewritten in C++
License: GPL-3.0-or-later
URL: https://gitlab.com/ananicy-cpp/ananicy-cpp
Source: %{url}/-/archive/v%{version}/%{name}-v%{version}.tar.gz
ExcludeArch: s390x i686 ppc64le
BuildRequires: gcc-c++ >= 10
BuildRequires: cmake >= 3.17
BuildRequires: pkgconfig(fmt) >= 8.0
BuildRequires: pkgconfig(spdlog) >= 1.9
BuildRequires: pkgconfig(nlohmann_json) >= 3.9
BuildRequires: pkgconfig(libsystemd)
%if %{with bpf}
BuildRequires: clang >= 10
BuildRequires: pkgconfig(libbpf)
BuildRequires: pkgconfig(libelf)
BuildRequires: bpftool
%endif
%systemd_requires
Recommends: ananicy-rules
Conflicts: ananicy
Provides: ananicy
%description
Ananicy (ANother Auto NICe daemon) is a shell daemon created to manage processes' IO and CPU priorities. Ananicy-Cpp is a drop-in replacement for the original Ananicy featuring lower CPU and RAM usage.
%prep
%autosetup -n %{name}-v%{version}
%build
%cmake \
-DVERSION:STRING=%{version} \
-DENABLE_SYSTEMD:BOOL=ON \
-DUSE_EXTERNAL_JSON:BOOL=ON \
-DUSE_EXTERNAL_SPDLOG:BOOL=ON \
-DUSE_EXTERNAL_FMTLIB:BOOL=ON \
-DBPF_BUILD_LIBBPF:BOOL=OFF \
-DUSE_BPF_PROC_IMPL:BOOL=%{?with_bpf:ON}%{!?with_bpf:OFF}
%cmake_build
%install
%cmake_install
install -m755 -d "%{buildroot}/etc/ananicy.d"
%pre
%service_add_pre %ananicy_service
%post
%service_add_post %ananicy_service
%preun
%service_del_preun %ananicy_service
%postun
%service_del_postun %ananicy_service
%files
%license LICENSE
%doc README.md
%{_bindir}/%name
%{_unitdir}/%ananicy_service
%changelog