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 <vmalik@redhat.com>
This commit is contained in:
Viktor Malik 2024-05-07 13:27:36 +02:00
parent 1730ed48fd
commit b3cd568953
No known key found for this signature in database
GPG Key ID: AF7A2E1F6EE74FB3
3 changed files with 28 additions and 19 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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 <vmalik@redhat.com> - 2:1.4.0-1
- Rebuild from latest RHEL 10.0 Beta source tree
- Resolves: RHEL-30627
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (v1.2.0.tar.gz) = b5291e807a3c83cb80a47e3518a3ab5ad0b0e6157842117c0684c32e525dce0cca199c3c9028390b94a73ff968391aa023312d3b8bd7472aff1c9ee5206c424e
SHA512 (linux-6.9.0-0.rc6.4.test.el10.tar.xz) = e688250dcb4035f3a70e4b7eff1855368dd65457543506d5f4abe340da904e0340139395e40e679fcdf61280163f9231ac89a90afb564d95f5814ac46a0711bf