From 839141257fca8c419a6cf91405f276b60d4efc69 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Fri, 1 Oct 2021 10:05:06 +0200 Subject: [PATCH] update to RHEL spec Related: rhbz#2009725 --- .gitignore | 1 + libbpf.spec | 39 ++++++++++++++++++++++++++------------- sources | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index a3e5758..9dc5b8f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /v0.1.0.tar.gz /v0.3.tar.gz /v0.4.0.tar.gz +/linux-5.14.0-5.el9.tar.xz diff --git a/libbpf.spec b/libbpf.spec index 3357cf9..8bcf79e 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -1,16 +1,20 @@ -%global githubname libbpf -%global githubver 0.4.0 -%global githubfull %{githubname}-%{githubver} +# 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} +# RHEL kernel version-release +%define kver 5.14.0-5 +%define source linux-%{kver}.el9 + +Name: libbpf +Version: 0.5.0 Release: 1%{?dist} Summary: Libbpf library License: LGPLv2 or BSD -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, @@ -26,7 +30,7 @@ ABI. %package devel Summary: Development files for %{name} Requires: %{name} = 2:%{version}-%{release} -Requires: kernel-headers >= 5.14.0-0.rc7.54 +Requires: kernel-headers >= %{kver} Requires: zlib %description devel @@ -43,16 +47,21 @@ developing applications that use %{name} %define _lto_cflags %{nil} -%global make_flags 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 EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=%{buildroot} V=1 %prep -%autosetup -n %{githubfull} +%setup -n %{source} %build -%make_build -C ./src %{make_flags} +pushd tools/lib/bpf +%{libbpf_make} prefix=%{_prefix} +popd %install -%make_install -C ./src %{make_flags} +pushd tools/lib/bpf +%{libbpf_make} prefix=%{_prefix} install_lib install_headers install_pkgconfig +popd %files %{_libdir}/libbpf.so.%{version} @@ -67,6 +76,10 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Fri Oct 1 2021 Jiri Olsa - 2:0.5.0-1 +- update to RHEL spec +- Related: rhbz#2009725 + * Wed Aug 25 2021 Jiri Olsa - 2:0.4.0-1 - updated to 0.4.0 Related: rhbz#1997597 diff --git a/sources b/sources index 4cb6216..3a34426 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v0.4.0.tar.gz) = 5d247f724f0dd3b2dadcc1ac10026ac57d3029b9dd7eb2831e282c58a4143042ef024170781139d89d85c4e9a3849b9ec0d3604a00bb3433be7622682b6dabc1 +SHA512 (linux-5.14.0-5.el9.tar.xz) = b46c10da644b7ba178bd3a9170b269b54f07a02714b8122fbc64062c4f8bc4357babb6ba332acf636628d90e45e06ead5ede93bf0b65622c6b37e78c4a3cccba