summaryrefslogtreecommitdiff
path: root/repo/libbpf
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-12-19 23:07:05 +0000
committerdavidovski <david@davidovski.xyz>2022-12-19 23:07:05 +0000
commit05d004dfe0c9a9d898fac8a4a0292ca2a74ca391 (patch)
tree0b058ac267139f2a0525dec42b307664363e5b11 /repo/libbpf
parent4c61af227b0fb3e028c877dc1c2e0b6513960762 (diff)
Making things work
Diffstat (limited to 'repo/libbpf')
-rw-r--r--repo/libbpf/10-consolidate-lib-dirs.patch19
-rw-r--r--repo/libbpf/libbpf.xibuild33
2 files changed, 52 insertions, 0 deletions
diff --git a/repo/libbpf/10-consolidate-lib-dirs.patch b/repo/libbpf/10-consolidate-lib-dirs.patch
new file mode 100644
index 0000000..8a270b7
--- /dev/null
+++ b/repo/libbpf/10-consolidate-lib-dirs.patch
@@ -0,0 +1,19 @@
+Alpine doesn't recognize lib64 directories by default, so we consolidate into lib.
+
+diff --git a/src/Makefile b/src/Makefile
+index e9021fe..1d86ecd 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -61,11 +61,7 @@ INSTALL = install
+
+ DESTDIR ?=
+
+-ifeq ($(filter-out %64 %64be %64eb %64le %64el s390x, $(shell uname -m)),)
+- LIBSUBDIR := lib64
+-else
+- LIBSUBDIR := lib
+-endif
++LIBSUBDIR := lib
+
+ # By default let the pc file itself use ${prefix} in includedir/libdir so that
+ # the prefix can be overridden at runtime (eg: --define-prefix)
diff --git a/repo/libbpf/libbpf.xibuild b/repo/libbpf/libbpf.xibuild
new file mode 100644
index 0000000..0e4993d
--- /dev/null
+++ b/repo/libbpf/libbpf.xibuild
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+NAME="libbpf"
+DESC="A library for interacting with the Linux kernel's Berkeley Packet Filter (BPF) facility from user space"
+
+MAKEDEPS="linux-headers elfutils zlib"
+
+PKG_VER=1.0.1
+SOURCE="https://github.com/libbpf/libbpf/archive/refs/tags/v$PKG_VER.tar.gz"
+
+ADDITIONAL="
+10-consolidate-lib-dirs.patch
+"
+
+build() {
+ cd src
+ make NO_PKG_CONFIG=1
+}
+
+check() {
+ echo "#include \"$BUILD_ROOT/src/btf.h\"" | gcc -xc -c -o /dev/null -
+}
+
+package() {
+ cd src
+ make install DESTDIR="$PKG_DEST"
+ # install somewhere out of the way that will hopefully not be included by mistake
+ mkdir -p "$PKG_DEST/usr/include/bpf/uapi/linux"
+ for header in bpf.h bpf_common.h btf.h; do
+ cp "$BUILD_ROOT/include/uapi/linux/$header" "$PKG_DEST/usr/include/bpf/uapi/linux/"
+ done
+}
+