Skip to content

Commit

Permalink
testing/bcc: split into subpackages
Browse files Browse the repository at this point in the history
  • Loading branch information
acj committed Aug 10, 2019
1 parent bd6c2b0 commit 1a51db2
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 137 deletions.
53 changes: 53 additions & 0 deletions testing/bcc/10-include-stddef.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
--- a/src/cc/libbpf.c
+++ b/src/cc/libbpf.c
@@ -25,7 +25,7 @@
#include <linux/bpf.h>
#include <linux/bpf_common.h>
#include <linux/if_packet.h>
-#include <linux/types.h>
+#include <linux/stddef.h>
#include <linux/perf_event.h>
#include <linux/pkt_cls.h>
#include <linux/rtnetlink.h>
--- a/src/cc/api/BPF.cc
+++ b/src/cc/api/BPF.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/

+#include <linux/stddef.h>
#include <linux/bpf.h>
#include <linux/perf_event.h>
#include <unistd.h>
--- a/src/cc/perf_reader.c
+++ b/src/cc/perf_reader.c
@@ -25,7 +25,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
-#include <linux/types.h>
+#include <linux/stddef.h>
#include <linux/perf_event.h>

#include "libbpf.h"
--- a/src/cc/api/BPFTable.cc
+++ b/src/cc/api/BPFTable.cc
@@ -16,6 +16,7 @@

#include <fcntl.h>
#include <linux/elf.h>
+#include <linux/stddef.h>
#include <linux/perf_event.h>
#include <sys/epoll.h>
#include <unistd.h>
--- a/src/cc/libbpf/src/libbpf.c
+++ b/src/cc/libbpf/src/libbpf.c
@@ -30,7 +30,7 @@
#include <linux/btf.h>
#include <linux/filter.h>
#include <linux/list.h>
-#include <linux/limits.h>
+#include <linux/stddef.h>
#include <linux/perf_event.h>
#include <linux/ring_buffer.h>
#include <sys/epoll.h>
132 changes: 0 additions & 132 deletions testing/bcc/10-use-system-libbpf.patch

This file was deleted.

10 changes: 10 additions & 0 deletions testing/bcc/20-libbpf-include-bits-reg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/src/cc/libbpf/src/hashmap.h
+++ b/src/cc/libbpf/src/hashmap.h
@@ -10,4 +10,5 @@

#include <stdbool.h>
#include <stddef.h>
+#include <bits/reg.h>
#include "libbpf_internal.h"

static inline size_t hash_bits(size_t h, int bits)
50 changes: 45 additions & 5 deletions testing/bcc/APKBUILD
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# Maintainer: Adam Jensen <acjensen@gmail.com>
pkgname=bcc
pkgver=0.10.0
pkgrel=0
pkgrel=1
pkgdesc="A toolkit for creating efficient kernel tracing and manipulation programs"
url="https://github.com/iovisor/bcc/"
arch="aarch64 x86 x86_64"
license="Apache-2.0"
# bcc's test suite requires privileged access to run BPF programs
options="!check"
depends="python"
subpackages="$pkgname-dev:_dev $pkgname-doc:_doc $pkgname-tools:_tools $pkgname-lua:_lua py-$pkgname:_py"
_libbpfver=0.0.4
_llvmver=8
makedepends="tar git llvm${_llvmver}-dev llvm${_llvmver}-static clang-dev clang-static cmake flex-dev
bison luajit-dev build-base iperf linux-headers elfutils-dev zlib-dev
libbpf-dev"
bison luajit-dev build-base iperf linux-headers elfutils-dev zlib-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/iovisor/$pkgname/archive/v$pkgver.tar.gz
10-use-system-libbpf.patch"
libbpf-$_libbpfver.tar.gz::https://github.com/libbpf/libbpf/archive/v$_libbpfver.tar.gz
10-include-stddef.patch
20-libbpf-include-bits-reg.patch"

prepare() {
mv "$srcdir"/libbpf-$_libbpfver/* "$builddir"/src/cc/libbpf

rm -rf tests/* && touch tests/CMakeLists.txt
rm -rf examples/* && touch examples/CMakeLists.txt

Expand All @@ -35,5 +40,40 @@ package() {
make install DESTDIR="$pkgdir"
}

_dev() {
depends="bcc"
mkdir -p "$subpkgdir"/usr/include
mv "$pkgdir"/usr/include/bcc "$subpkgdir"/usr/include/bcc
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/pkgconfig "$subpkgdir"/usr/lib/pkgconfig
}

_doc() {
mkdir -p "$subpkgdir"/usr/share/bcc/tools
mv "$pkgdir"/usr/share/bcc/man "$subpkgdir"/usr/share/bcc
mv "$pkgdir"/usr/share/bcc/tools/doc "$subpkgdir"/usr/share/bcc/tools
}

_tools() {
depends="bcc py-bcc"
mkdir -p "$subpkgdir"/usr/share/bcc
mv "$pkgdir"/usr/share/bcc/tools "$subpkgdir"/usr/share/bcc
mv "$pkgdir"/usr/share/bcc/introspection "$subpkgdir"/usr/share/bcc
}

_py() {
depends="bcc"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/python2.7 "$subpkgdir"/usr/lib/python2.7
}

_lua() {
depends="bcc"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/bcc-lua "$subpkgdir"/usr/bin
}

sha512sums="92ba0f57d22af610ac81661526fed8bec80d502bcbc8aa5048ba7c50911247c020832db23afdcf9b555b142cd387c228cf7baa0ddc94067165403e362227f235 bcc-0.10.0.tar.gz
e2f0cc063a13e2d5ad57db364e29c064f2c351b82bbd4013d613614adab3b9f4aa555ac71e06189807d32211fdef5c9520b4bc5df2db5de3db02123503d242a8 10-use-system-libbpf.patch"
1e4a16ed0f3e378aa9d7080e4b54cb3a9542975105b09977d1ddecf3ae4dabb3b5edf80b92b61644b1f0cbda7ee7e135ee0f736e71c1d201a97b1b3dd573b543 libbpf-0.0.4.tar.gz
8732a2f7fc016eb3c6bfe72f89bb91c2a19dccb26bade2f38be09336cac20049a5d5f6952fdc615448e7c3e4e5c9c7b51dd024e344c225c99856c93d4630af0c 10-include-stddef.patch
5b7b609d19c80b7b0428c457b149bf9f7a53ea739c90fd6f8fa9d5ff08fd7a3f6d16196bc7766424232f025f7ea42086a011b7d5028e397c18c807e1c7bc761a 20-libbpf-include-bits-reg.patch"

0 comments on commit 1a51db2

Please sign in to comment.