From 9eeeda7c0d2d5a4fd50c81fe14298dd70b60341d Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Wed, 28 Nov 2018 09:50:39 +0100 Subject: [PATCH] Add versioned libbpf, libbpf-dev package (Closes: #914428) --- debian/.gitignore | 1 + debian/changelog | 1 + debian/libbpf-dev.install | 3 ++ debian/rules.d/tools/Makefile | 1 + debian/rules.d/tools/lib/bpf/Makefile | 17 ++++++++++ debian/rules.real | 32 +++++++++++++++++-- debian/templates/control.source.in | 2 +- debian/templates/control.tools-unversioned.in | 20 ++++++++++++ 8 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 debian/libbpf-dev.install create mode 100644 debian/rules.d/tools/lib/bpf/Makefile diff --git a/debian/.gitignore b/debian/.gitignore index 17df2ad45..0d54bc2db 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -13,6 +13,7 @@ /control.md5sum /files /hyperv-daemons/ +/libbpf*/ /libcpupower*/ /liblockdep*/ /libusbip-dev/ diff --git a/debian/changelog b/debian/changelog index 312d7c375..35210c08c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -46,6 +46,7 @@ linux (4.19.8-1~exp1) UNRELEASED; urgency=medium [ Hilko Bengen ] * Add patches to build libbpf.so with SONAME, link against libelf + * Add versioned libbpf, libbpf-dev package (Closes: #914428) -- Uwe Kleine-König Wed, 28 Nov 2018 12:20:46 +0100 diff --git a/debian/libbpf-dev.install b/debian/libbpf-dev.install new file mode 100644 index 000000000..6a75abeff --- /dev/null +++ b/debian/libbpf-dev.install @@ -0,0 +1,3 @@ +usr/include/bpf +usr/lib/*/libbpf.a +usr/lib/*/libbpf.so diff --git a/debian/rules.d/tools/Makefile b/debian/rules.d/tools/Makefile index 3c7dba384..224f125b8 100644 --- a/debian/rules.d/tools/Makefile +++ b/debian/rules.d/tools/Makefile @@ -1,5 +1,6 @@ SUBDIRS = \ hv \ + lib/bpf \ lib/lockdep \ objtool \ perf \ diff --git a/debian/rules.d/tools/lib/bpf/Makefile b/debian/rules.d/tools/lib/bpf/Makefile new file mode 100644 index 000000000..26e231d2c --- /dev/null +++ b/debian/rules.d/tools/lib/bpf/Makefile @@ -0,0 +1,17 @@ +include $(top_rulesdir)/Makefile.inc + +DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +# Catch use of missing kernel APIs early +CFLAGS += -Werror=implicit-function-declaration + +MAKE_BPF := +$(MAKE) -C $(top_srcdir)/$(OUTDIR) +MAKE_BPF += prefix=/usr +MAKE_BPF += libdir_relative=lib/$(DEB_HOST_MULTIARCH) +MAKE_BPF += V=$(KBUILD_VERBOSE) + +all: + $(MAKE_BPF) + +install: + $(MAKE_BPF) install install_headers diff --git a/debian/rules.real b/debian/rules.real index b48fb515b..2d6c88c95 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -105,8 +105,8 @@ ifneq ($(DO_TOOLS_VERSIONED),False) endif endif ifneq ($(DO_TOOLS_UNVERSIONED),False) - build-arch-arch:build-usbip build-cpupower build-liblockdep - binary-arch-arch: install-usbip install-cpupower install-liblockdep + build-arch-arch:build-usbip build-cpupower build-liblockdep build-libbpf + binary-arch-arch: install-usbip install-cpupower install-liblockdep install-libbpf ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),) build-arch-arch: build-hyperv-daemons binary-arch-arch: install-hyperv-daemons @@ -770,6 +770,34 @@ endif dh_md5sums dh_builddeb +build-libbpf: + $(call make-tools,tools/lib/bpf) + +install-libbpf: DH_OPTIONS = -plibbpf$(VERSION) -plibbpf-dev +install-libbpf: DIR = $(CURDIR)/debian/libbpf-tmp +install-libbpf: build-libbpf + dh_testdir + dh_testroot + dh_prep + $(call make-tools,tools/lib/bpf) install DESTDIR=$(DIR) + env -u DH_OPTIONS dh_install -plibbpf$(VERSION) --sourcedir=$(DIR) \ + 'usr/lib/*/libbpf.so.*' + dh_install --sourcedir=$(DIR) + dh_installchangelogs +ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) + dh_installdocs +endif + dh_strip + dh_compress + dh_fixperms + env -u DH_OPTIONS dh_makeshlibs -plibbpf$(VERSION) \ + libbpf$(VERSION) + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + build-liblockdep: $(call make-tools,tools/lib/lockdep) diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in index a84cd3e83..0d0f5e139 100644 --- a/debian/templates/control.source.in +++ b/debian/templates/control.source.in @@ -28,7 +28,7 @@ Build-Depends-Arch: libssl-dev:native , libssl-dev , openssl (>= 1.1.0-1~) , # used by upstream to build objtool (native for amd64 images; host arch for -# linux-kbuild) and perf (host arch) +# linux-kbuild), perf (host arch), libbpf (host arch) libelf-dev:native [amd64] , libelf-dev , Rules-Requires-Root: no Vcs-Git: https://salsa.debian.org/kernel-team/linux.git diff --git a/debian/templates/control.tools-unversioned.in b/debian/templates/control.tools-unversioned.in index d6a898fe7..312dea1cf 100644 --- a/debian/templates/control.tools-unversioned.in +++ b/debian/templates/control.tools-unversioned.in @@ -111,3 +111,23 @@ Multi-Arch: same Description: Runtime locking correctness validator (development files) liblockdep is a library for programs that use the pthreads API, which can be used to detect actual and potential deadlocks and other locking bugs. + +Package: libbpf@version@ +Build-Profiles: +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: libs +Multi-Arch: same +Description: eBPF helper library (shared library) + libbpf is a library for loading eBPF programs and reading and + manipulating eBPF objects from user-space. + +Package: libbpf-dev +Build-Profiles: +Architecture: linux-any +Depends: ${misc:Depends}, libbpf@version@ (= ${binary:Version}) +Section: libdevel +Multi-Arch: same +Description: eBPF helper library (development files) + libbpf is a library for loading eBPF programs and reading and + manipulating eBPF objects from user-space.