From f95edf7b5bd7dc98cf99afc7f97ba230dba1983a6a7acf98972a70d7c2616de9 Mon Sep 17 00:00:00 2001 From: Shung-Hsi Yu Date: Wed, 22 May 2024 14:17:23 +0000 Subject: [PATCH] Accepting request 1175868 from home:shunghsiyu:branches:bpf Update LLVM version selection logic to align with bcc and bpftrace and narrow down the dependency to clang and llvm. OBS-URL: https://build.opensuse.org/request/show/1175868 OBS-URL: https://build.opensuse.org/package/show/Base:System/bpftool?expand=0&rev=22 --- bpftool.changes | 6 ++++++ bpftool.spec | 35 ++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/bpftool.changes b/bpftool.changes index 069ff68..30395ee 100644 --- a/bpftool.changes +++ b/bpftool.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 22 09:43:32 UTC 2024 - Shung-Hsi Yu + +- Update LLVM version selection logic to align with bcc and bpftrace + * narrow down the dependency to clang and llvm + ------------------------------------------------------------------- Thu Apr 11 07:02:33 UTC 2024 - Fredrik Lönnegren diff --git a/bpftool.spec b/bpftool.spec index 0397a97..9805767 100644 --- a/bpftool.spec +++ b/bpftool.spec @@ -16,6 +16,28 @@ # +# Use default LLVM on openSUSE unless it is not yet supported +%if 0%{?suse_version} >= 1600 || 0%{?is_opensuse} + %if 0%{?product_libs_llvm_ver} > 17 + %define llvm_major_version 17 + %else + %define llvm_major_version %{nil} + %endif +%else + # Hard-code latest LLVM for SLES, the default version is too old + %if 0%{?sle_version} == 150600 + %define llvm_major_version 17 + %else + %if 0%{?sle_version} == 150500 + %define llvm_major_version 15 + %else + %if 0%{?sle_version} == 150400 + %define llvm_major_version 11 + %endif + %endif + %endif +%endif + Name: bpftool Version: 7.4.0 Release: 0 @@ -26,19 +48,14 @@ URL: https://www.kernel.org/ Source0: https://github.com/libbpf/bpftool/releases/download/v%{version}/bpftool-libbpf-v%{version}-sources.tar.gz Patch0: binutils-2.40.patch BuildRequires: binutils-devel -%if 0%{?suse_version} && 0%{?suse_version} <= 1500 -%if 0%{?sle_version} < 150400 -BuildRequires: clang12-devel -%else -BuildRequires: clang13-devel -%endif -%else -BuildRequires: clang-devel -%endif +# Needed for compiling included BPF program (i.e. skeletons) +BuildRequires: clang%{llvm_major_version} BuildRequires: docutils BuildRequires: libcap-devel BuildRequires: libelf-devel BuildRequires: libzstd-devel +# llvm-strip is needed for the included BPF program (i.e. skeletons) +BuildRequires: llvm%{llvm_major_version} %description bpftool allows for inspection and simple modification of BPF objects (programs