summaryrefslogtreecommitdiffstats
path: root/packaging/bundle-libbpf.sh
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2020-07-30 07:09:59 -0400
committerGitHub <noreply@github.com>2020-07-30 07:09:59 -0400
commit8a105bad8188b7581c92811c069676d3110f130b (patch)
tree0c6358e5c8c5f7b25436760b298b0de3107f4a1f /packaging/bundle-libbpf.sh
parentfdbc559ff9c317ce6cf42a72ea466a2b47211971 (diff)
Added eBPF collector support to DEB and RPM packages. (#9628)
* Add DEB/RPM package build tests to Travis. * Add working support for bundling eBPF in binary packages. * Show stdout and stderr from commands run in LXC. * Add proper bundling code for libbpf. * Use AC_CHECK_FILE for libbpf.a external dep. This way it gets properly logged in both configure output and the configure log.
Diffstat (limited to 'packaging/bundle-libbpf.sh')
-rwxr-xr-xpackaging/bundle-libbpf.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/packaging/bundle-libbpf.sh b/packaging/bundle-libbpf.sh
new file mode 100755
index 0000000000..53b8da290d
--- /dev/null
+++ b/packaging/bundle-libbpf.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+LIBBPF_TARBALL="v$(cat "${1}/packaging/libbpf.version").tar.gz"
+LIBBPF_BUILD_PATH="${1}/externaldeps/libbpf/libbpf-$(cat "${1}/packaging/libbpf.version")"
+
+if [ "$(uname -m)" = x86_64 ]; then
+ lib_subdir="lib64"
+else
+ lib_subdir="lib"
+fi
+
+mkdir -p "${1}/externaldeps/libbpf" || exit 1
+curl -sSL --connect-timeout 10 --retry 3 "https://github.com/libbpf/libbpf/archive/${LIBBPF_TARBALL}" > "${LIBBPF_TARBALL}" || exit 1
+sha256sum -c "${1}/packaging/libbpf.checksums" || exit 1
+tar -xzf "${LIBBPF_TARBALL}" -C "${1}/externaldeps/libbpf" || exit 1
+LPWD="${PWD}"
+cd "${LIBBPF_BUILD_PATH}" || exit 1
+patch -p1 < "${1}/libnetdata/ebpf/libbpf.c.diff" || exit 1
+cd "${LPWD}" || exit 1
+make -C "${LIBBPF_BUILD_PATH}/src" BUILD_STATIC_ONLY=1 OBJDIR=build/ DESTDIR=../ install || exit 1
+cp -a "${LIBBPF_BUILD_PATH}/usr/${lib_subdir}/libbpf.a" "${1}/externaldeps/libbpf" || exit 1
+cp -a "${LIBBPF_BUILD_PATH}/usr/include" "${1}/externaldeps/libbpf" || exit 1