From: Thorsten Leemhuis <fedora(a)leemhuis.info>
add libperf packages and enable perf, libperf, tools and bpftool packages
Signed-off-by: Thorsten Leemhuis <fedora(a)leemhuis.info>
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -224,6 +224,8 @@ Summary: The Linux kernel
%define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers:
1}
# perf
%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1}
+# libperf
+%define with_libperf %{?_without_libperf: 0} %{?!_without_libperf: 1}
# tools
%define with_tools %{?_without_tools: 0} %{?!_without_tools: 1}
# bpf tool
@@ -300,9 +302,10 @@ Summary: The Linux kernel
# no stablelist
%define with_kernel_abi_stablelists 0
# Fedora builds these separately
-%define with_perf 0
-%define with_tools 0
-%define with_bpftool 0
+%define with_perf 1
+%define with_libperf 1
+%define with_tools 1
+%define with_bpftool 1
# No realtime fedora variants
%define with_realtime 0
%define with_arm64_64k 0
@@ -388,6 +391,7 @@ Summary: The Linux kernel
%define with_realtime 0
%define with_vdso_install 0
%define with_perf 0
+%define with_libperf 0
%define with_tools 0
%define with_bpftool 0
%define with_kernel_abi_stablelists 0
@@ -402,6 +406,7 @@ Summary: The Linux kernel
%define with_base 0
%define with_vdso_install 0
%define with_perf 0
+%define with_libperf 0
%define with_tools 0
%define with_bpftool 0
%define with_kernel_abi_stablelists 0
@@ -417,6 +422,7 @@ Summary: The Linux kernel
%define with_debuginfo 0
%define with_vdso_install 0
%define with_perf 0
+%define with_libperf 0
%define with_tools 0
%define with_bpftool 0
%define with_kernel_abi_stablelists 0
@@ -480,6 +486,7 @@ Summary: The Linux kernel
%define with_cross_headers 0
%define with_tools 0
%define with_perf 0
+%define with_libperf 0
%define with_bpftool 0
%define with_selftests 0
%define with_debug 0
@@ -572,6 +579,7 @@ Summary: The Linux kernel
%define with_debuginfo 0
%define with_perf 0
+%define with_libperf 0
%define with_tools 0
%define with_bpftool 0
%define with_selftests 0
@@ -1124,6 +1132,23 @@ This package provides debug information for the perf python
bindings.
# with_perf
%endif
+%if %{with_libperf}
+%package -n libperf
+Summary: The perf library from kernel source
+License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause)
+%description -n libperf
+This package contains the kernel source perf library.
+
+%package -n libperf-devel
+Summary: Developement files for the perf library from kernel source
+License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause)
+%description -n libperf-devel
+This package includes libraries and header files needed for development
+of applications which use perf library from kernel source.
+
+# with_libperf
+%endif
+
%if %{with_tools}
%package -n %{package_name}-tools
Summary: Assortment of tools for the Linux kernel
@@ -2728,6 +2753,12 @@ chmod +x tools/perf/check-headers.sh
%{perf_make} DESTDIR=$RPM_BUILD_ROOT all
%endif
+%if %{with_libperf}
+%global libperf_make \
+ %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}"
LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/lib/perf V=1
+%{libperf_make} DESTDIR=$RPM_BUILD_ROOT
+%endif
+
%global tools_make \
CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{make}
%{?make_opts}
@@ -3009,6 +3040,10 @@ mkdir -p %{buildroot}/%{_mandir}/man1
rm -rf %{buildroot}%{_libdir}/traceevent
%endif
+%if %{with_libperf}
+%{libperf_make} DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} install
install_headers
+%endif
+
%if %{with_tools}
%ifarch %{cpupowerarchs}
%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir}
mandir=%{_mandir} CPUFREQ_BENCH=false install
@@ -3494,6 +3529,37 @@ fi\
# with_perf
%endif
+%if %{with_libperf}
+%files -n libperf
+%{_libdir}/libperf.so.0
+%{_libdir}/libperf.so.0.0.1
+
+%files -n libperf-devel
+%{_libdir}/libperf.so
+%{_libdir}/pkgconfig/libperf.pc
+%{_includedir}/internal/*.h
+%{_includedir}/perf/bpf_perf.h
+%{_includedir}/perf/core.h
+%{_includedir}/perf/cpumap.h
+%{_includedir}/perf/perf_dlfilter.h
+%{_includedir}/perf/event.h
+%{_includedir}/perf/evlist.h
+%{_includedir}/perf/evsel.h
+%{_includedir}/perf/mmap.h
+%{_includedir}/perf/threadmap.h
+%{_mandir}/man3/libperf.3.gz
+%{_mandir}/man7/libperf-counting.7.gz
+%{_mandir}/man7/libperf-sampling.7.gz
+%{_docdir}/libperf/examples/sampling.c
+%{_docdir}/libperf/examples/counting.c
+%{_docdir}/libperf/html/libperf.html
+%{_docdir}/libperf/html/libperf-counting.html
+%{_docdir}/libperf/html/libperf-sampling.html
+
+# with_libperf
+%endif
+
+
%if %{with_tools}
%ifnarch %{cpupowerarchs}
%files -n %{package_name}-tools
@@ -3543,6 +3609,8 @@ fi\
%files -n %{package_name}-tools-libs-devel
%{_libdir}/libcpupower.so
%{_includedir}/cpufreq.h
+%{_includedir}/cpuidle.h
+%{_includedir}/powercap.h
%endif
%files -n rtla
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907