diff --git a/libbpf.changes b/libbpf.changes index 516fc60..6d98f83 100644 --- a/libbpf.changes +++ b/libbpf.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Feb 2 19:50:55 UTC 2020 - Michał Rostecki + +- Build libbpf from kernel sources, not from github sources, for + consistency with bpftool package. + ------------------------------------------------------------------- Tue Jan 7 14:36:44 UTC 2020 - Tomáš Chvátal diff --git a/libbpf.spec b/libbpf.spec index 1b5a540..8597fe7 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -19,13 +19,14 @@ %define sover_major 0 %define libname libbpf%{sover_major} Name: libbpf -Version: 0.0.6 +%define version %(rpm -q --qf '%%{VERSION}' kernel-source) +Version: %{version} Release: 0 Summary: C library for managing eBPF programs and maps License: LGPL-2.1-only -URL: https://github.com/libbpf/libbpf -Source: https://github.com/libbpf/libbpf/archive/v%{version}.tar.gz +URL: http://www.kernel.org/ BuildRequires: libelf-devel +BuildRequires: kernel-source %description libbpf is a C library which provides API for managing eBPF programs and maps. @@ -44,13 +45,27 @@ Requires: %{libname} = %{version} libbpf is a C library which provides API for managing eBPF programs and maps. %prep -%setup -q +(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 %build -%make_build -C src/ CFLAGS="%{optflags}" +cd tools/lib/bpf +%if %{__isa_bits} == 64 +%make_build CFLAGS="%{optflags}" LP64=1 +%else +%make_build CFLAGS="%{optflags}" +%endif %install -%make_install -C src/ +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 + rm -f %{buildroot}%{_libdir}/%{name}.a %post -n %{libname} -p /sbin/ldconfig diff --git a/v0.0.6.tar.gz b/v0.0.6.tar.gz deleted file mode 100644 index 2a1f003..0000000 --- a/v0.0.6.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dbed8304077699fd59b0271545ac5923a6e0581db4ef90d6124efa6fe9df84c1 -size 213791