File bpftune.spec of Package bpftune

#
# spec file for package bpftune
#
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
#
# 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 soname 0_4_2
Name:           bpftune
Version:        0.x
Release:        0
Summary:        BPF/tracing tools for auto-tuning Linux
License:        GPL-2.0-only WITH Linux-syscall-note
URL:            https://github.com/oracle/bpftune/
Source:         %{name}-%{version}.tar.xz
BuildRequires:  bpftool >= 4.18
BuildRequires:  clang >= 11
BuildRequires:  llvm >= 11
BuildRequires:  pkgconfig
BuildRequires:  python3-docutils
BuildRequires:  pkgconfig(libbpf) >= 0.6
BuildRequires:  pkgconfig(libcap)
BuildRequires:  pkgconfig(libnl-3.0)
# assertions in code exlude certain architectures
ExcludeArch:    %{ix86} s390x %{arm} ppc64le riscv64

%description
Service consisting of daemon (bpftune) and plugins which support auto-tuning of
Linux via BPF observability.

%package -n libbpftune%{soname}
Summary:        BPF/tracing library

%description -n libbpftune%{soname}
Shared library for (bpftune) for auto-tuning of Linux via BPF observability.

%package devel
Summary:        Development files for %{name}
Requires:       %{name} = %{version}
Requires:       libbpftune%{soname} = %{version}

%description devel
The %{name}-devel package contains libraries and header files for
developing BPF shared object tuners that use %{name}

%package pcp-pmda
Summary:	    Performance Co-Pilot PMDA for bpftune
Requires:       %{name} = %{version}-%{release}
Requires:	    pcp
Requires:       python3-pcp 

%description pcp-pmda
The %{name}-pcp-pmda exports tunables and metrics from bpftune
to Performance Co-Pilot (PCP)

%prep
%autosetup -p1

%build
export CC=clang
%make_build \
	BPFTOOL=%{_sbindir}/bpftool \
	%{nil}

%install
export CC=clang
%make_install

# %%check
# /usr/sbin/tc needs root
# %%make_build test

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%ldconfig_scriptlets -n lib%{name}%{soname}

%files
%license LICENSE.txt
%{_sbindir}/%{name}
%{_unitdir}/%{name}.service
%dir %{_sysconfdir}/conf.d
%{_sysconfdir}/conf.d/%{name}
%exclude %{_sysconfdir}/init.d/%{name}
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*.so
%{_mandir}/man8/*.gz

%files -n lib%{name}%{soname}
%license LICENSE.txt
%{_sysconfdir}/ld.so.conf.d/lib%{name}.conf
%{_libdir}/lib%{name}.so.*

%files devel
%license LICENSE.txt
%{_includedir}/%{name}
%{_libdir}/lib%{name}.so

%files pcp-pmda
%dir /var/lib/pcp/
%dir /var/lib/pcp/pmdas
%dir /var/lib/pcp/pmdas/%{name}
/var/lib/pcp/pmdas/%{name}/*

%changelog
openSUSE Build Service is sponsored by