From b3cd5689534d74347b0a5e0529466035db048fd5 Mon Sep 17 00:00:00 2001 From: Viktor Malik Date: Tue, 7 May 2024 13:27:36 +0200 Subject: [PATCH] Update to RHEL packaging and rebuild for RHEL Resolves: RHEL-30627 RHEL packaging of libbpf differs from the Fedora one as in RHEL, we are building libbpf directly from the kernel source tree (not GitHub repo). Therefore, the "source" is the corresponding kernel tarball. The reason for this difference is that BPF selftests (the only way of testing libbpf) are not able to work with system-wide libbpf (i.e. the one we would build from GitHub). The changes to specfile are mostly taken from the c9s specfile, with some minor changes. Signed-off-by: Viktor Malik --- .gitignore | 1 + libbpf.spec | 44 ++++++++++++++++++++++++++------------------ sources | 2 +- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index e7d820f..39d10a5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /libbpf-Fix-null-pointer-dereference-in-find_prog_by_.patch /v1.1.0.tar.gz /v1.2.0.tar.gz +/linux-6.9.0-0.rc6.4.test.el10.tar.xz diff --git a/libbpf.spec b/libbpf.spec index 539bd98..37cade2 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -1,17 +1,20 @@ -%global githubname libbpf -%global githubver 1.2.0 -%global githubfull %{githubname}-%{githubver} -%global libver 1.2.0 +# We build libbpf from RHEL kernel sources, that's why we use +# directly kernel tar for RHEL kernel build. +# We update libbpf's 'sources' file with proper hash that's +# used as kernel tar. -Name: %{githubname} -Version: %{githubver} -Release: 3%{?dist} +# RHEL kernel version-release +%define kver 6.9.0-0.rc6.4.test +%define source linux-%{kver}%{?dist} + +Name: libbpf +Version: 1.4.0 +Release: 1%{?dist} Summary: Libbpf library License: LGPL-2.1-only OR BSD-2-Clause -URL: https://github.com/%{githubname}/%{githubname} -Source: https://github.com/%{githubname}/%{githubname}/archive/v%{githubver}.tar.gz -BuildRequires: gcc elfutils-libelf-devel elfutils-devel +Source0: %{source}.tar.xz +BuildRequires: gcc elfutils-libelf-devel elfutils-devel python3 BuildRequires: make # This package supersedes libbpf from kernel-tools, @@ -27,7 +30,7 @@ ABI. %package devel Summary: Development files for %{name} Requires: %{name} = 2:%{version}-%{release} -Requires: kernel-headers >= 5.16.0 +Requires: kernel-headers >= %{kver} Requires: zlib %description devel @@ -44,21 +47,22 @@ developing applications that use %{name} %define _lto_cflags %{nil} -%global make_flags PREFIX=%{_prefix} INCLUDEDIR=%{_includedir} DESTDIR=%{buildroot} \ - OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} \ - -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1 +%global libbpf_make \ + make prefix=%{_prefix} DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1 %prep -%autosetup -n %{githubfull} -p1 +%setup -n %{source} %build -%make_build -C ./src %{make_flags} +pushd tools/lib/bpf +%{libbpf_make} %install -%make_install -C ./src %{make_flags} +pushd tools/lib/bpf +%{libbpf_make} install %files -%{_libdir}/libbpf.so.%{libver} +%{_libdir}/libbpf.so.%{version} %{_libdir}/libbpf.so.1 %files devel @@ -70,6 +74,10 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Tue May 07 2024 Viktor Malik - 2:1.4.0-1 +- Rebuild from latest RHEL 10.0 Beta source tree +- Resolves: RHEL-30627 + * Thu Jan 25 2024 Fedora Release Engineering - 2:1.2.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index 89c9a81..9c71eb4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v1.2.0.tar.gz) = b5291e807a3c83cb80a47e3518a3ab5ad0b0e6157842117c0684c32e525dce0cca199c3c9028390b94a73ff968391aa023312d3b8bd7472aff1c9ee5206c424e +SHA512 (linux-6.9.0-0.rc6.4.test.el10.tar.xz) = e688250dcb4035f3a70e4b7eff1855368dd65457543506d5f4abe340da904e0340139395e40e679fcdf61280163f9231ac89a90afb564d95f5814ac46a0711bf