SHA256
1
0
forked from pool/libbpf

Accepting request 907038 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/907038
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libbpf?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2021-07-21 17:05:42 +00:00 committed by Git OBS Bridge
commit 62dc279025
4 changed files with 58 additions and 22 deletions

3
libbpf-0.4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:21cbee4df093e7fd29e76ed429650d3f3abe3a893f35e346ab9bc3484f6e68c0
size 1015782

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sat Jul 17 15:38:52 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- libbpf is now a separate project, stop building from the kernel
(bsc#1188419 jsc#SLE-17288 jsc#SLE-18805).
- Fix LIBSUBDIR
+ libdir.patch
-------------------------------------------------------------------
Mon Jun 8 23:52:39 UTC 2020 - Michał Rostecki <mrostecki@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package libbpf
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,15 +19,17 @@
%define sover_major 0
%define libname libbpf%{sover_major}
Name: libbpf
%define version %(rpm -q --qf '%%{VERSION}' kernel-source)
Version: %{version}
Version: 0.4.0
Release: 0
Summary: C library for managing eBPF programs and maps
License: LGPL-2.1-only
URL: http://www.kernel.org/
BuildRequires: kernel-source
URL: https://github.com/libbpf/libbpf
Source: https://github.com/libbpf/libbpf/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/libbpf/libbpf/issues/337
Patch: libdir.patch
BuildRequires: libelf-devel
BuildRequires: python3
BuildRequires: zlib-devel
%description
libbpf is a C library which provides API for managing eBPF programs and maps.
@ -46,27 +48,15 @@ Requires: %{libname} = %{version}
libbpf is a C library which provides API for managing eBPF programs and maps.
%prep
(cd /usr/src/linux ; tar -cf - COPYING CREDITS README tools include scripts Kbuild Makefile arch/*/{include,lib,Makefile} kernel/bpf lib) | tar -xf -
cp /usr/src/linux/LICENSES/preferred/GPL-2.0 .
sed -i -e 's/CFLAGS += -O2/CFLAGS = $(RPM_OPT_FLAGS)/' Makefile
%setup -q
%build
cd tools/lib/bpf
%if %{__isa_bits} == 64
%make_build CFLAGS="%{optflags}" LP64=1
%else
%make_build CFLAGS="%{optflags}"
%endif
cd src
%make_build V=1 CFLAGS="%{optflags} -fno-lto"
%install
cd tools/lib/bpf
%if %{__isa_bits} == 64
%make_install prefix=/usr LP64=1
%else
%make_install prefix=/usr
%endif
make install_headers prefix=%{buildroot}/usr
cd src
%make_install V=1 LIBDIR=%{_libdir}
rm -f %{buildroot}%{_libdir}/%{name}.a
%post -n %{libname} -p /sbin/ldconfig
@ -76,6 +66,8 @@ rm -f %{buildroot}%{_libdir}/%{name}.a
%{_libdir}/%{name}.so.%{sover_major}*
%files devel
%license LICENSE LICENSE.BSD-2-Clause LICENSE.LGPL-2.1
%doc README.md
%{_includedir}/bpf
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

33
libdir.patch Normal file
View File

@ -0,0 +1,33 @@
From 60ab75597d2735e8f7bf91e4423feab87568d1e7 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Sun, 18 Jul 2021 22:05:01 +0200
Subject: [PATCH] Makefile: Default LIBSUBDIR to lib64 on 64bit architectures.
commit a82a66e ("Extend build and add install rules to Makefile") adds
special handling for LIBSUBDIR on x86_64. Expand this to all
architectures with 64 in name which suggests a 32bit variant exists, and
s390x which is 64bit extension of s390.
Fixes: #337
Fixes: a82a66e ("Extend build and add install rules to Makefile")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 8161fec..8bf1d8a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -60,7 +60,7 @@ INSTALL = install
DESTDIR ?=
-ifeq ($(shell uname -m),x86_64)
+ifeq ($(filter-out %64 %64be %64eb %64le %64el s390x, $(shell uname -m)),)
LIBSUBDIR := lib64
else
LIBSUBDIR := lib
--
2.32.0