summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorTasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com>2023-03-01 15:03:51 +0200
committerGitHub <noreply@github.com>2023-03-01 15:03:51 +0200
commit513452aa447759acecb16504673db7dce40ffaa2 (patch)
tree85164f59dd18431f2b12b0aafe304a0a56e42c5c /packaging
parent4c20aca875a0784ff807c980a8fae2f7fb7d51a0 (diff)
Link statically libnetfilter_acct into our static builds (#14516)
Bundle the nfacct dependencies libnetfilter_acct as static lib from source archives and libmnl as static lib from the alpines' packages (regular package manager) into our Netdata static binaries Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/makeself/functions.sh7
-rwxr-xr-xpackaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh39
-rwxr-xr-xpackaging/makeself/jobs/70-netdata-git.install.sh9
3 files changed, 48 insertions, 7 deletions
diff --git a/packaging/makeself/functions.sh b/packaging/makeself/functions.sh
index 31c28d85c0..c3289c7cd2 100755
--- a/packaging/makeself/functions.sh
+++ b/packaging/makeself/functions.sh
@@ -30,7 +30,8 @@ set -euo pipefail
fetch() {
local dir="${1}" url="${2}" sha256="${3}" key="${4}"
- local tar="${dir}.tar.gz"
+ local tar
+ tar="$(basename "${2}")"
local cache="${NETDATA_SOURCE_PATH}/artifacts/cache/${BUILDARCH}/${key}"
if [ -d "${NETDATA_MAKESELF_PATH}/tmp/${dir}" ]; then
@@ -58,10 +59,10 @@ fetch() {
echo >&2 "expected: ${sha256}, got $(sha256sum "${NETDATA_MAKESELF_PATH}/tmp/${tar}")"
exit 1
fi
- set -e
+ set -e
cd "${NETDATA_MAKESELF_PATH}/tmp"
- run tar -zxpf "${tar}"
+ run tar -axpf "${tar}"
cd -
CACHE_HIT=0
diff --git a/packaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh b/packaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh
new file mode 100755
index 0000000000..2b7a761c55
--- /dev/null
+++ b/packaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Install the libnetfilter_acct and it's dependency libmnl
+#
+
+# shellcheck source=packaging/makeself/functions.sh
+. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
+
+version="1.0.3"
+
+# shellcheck disable=SC2015
+[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::building libnetfilter_acct" || true
+
+export CFLAGS="-static -I/usr/include/libmnl -pipe"
+export LDFLAGS="-static -L/usr/lib -lmnl"
+export PKG_CONFIG="pkg-config --static"
+export PKG_CONFIG_PATH="/usr/lib/pkgconfig"
+
+fetch "libnetfilter_acct-${version}" "https://www.netfilter.org/projects/libnetfilter_acct/files/libnetfilter_acct-${version}.tar.bz2" \
+ 4250ceef3efe2034f4ac05906c3ee427db31b9b0a2df41b2744f4bf79a959a1a libnetfilter_acct
+
+
+if [ "${CACHE_HIT:-0}" -eq 0 ]; then
+ run ./configure \
+ --prefix="/libnetfilter-acct-static" \
+ --exec-prefix="/libnetfilter-acct-static"
+
+ run make clean
+ run make -j "$(nproc)"
+fi
+
+run make install
+
+store_cache libnetfilter_acct "${NETDATA_MAKESELF_PATH}/tmp/libnetfilter_acct-${version}"
+
+
+# shellcheck disable=SC2015
+[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true
diff --git a/packaging/makeself/jobs/70-netdata-git.install.sh b/packaging/makeself/jobs/70-netdata-git.install.sh
index 2c4fb3007b..2448a0c2b9 100755
--- a/packaging/makeself/jobs/70-netdata-git.install.sh
+++ b/packaging/makeself/jobs/70-netdata-git.install.sh
@@ -7,12 +7,12 @@
cd "${NETDATA_SOURCE_PATH}" || exit 1
if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
- export CFLAGS="-static -O2 -I/openssl-static/include -pipe"
+ export CFLAGS="-static -O2 -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/usr/include/libmnl -pipe"
else
- export CFLAGS="-static -O1 -pipe -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include"
+ export CFLAGS="-static -O1 -pipe -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/usr/include/libmnl"
fi
-export LDFLAGS="-static -L/openssl-static/lib"
+export LDFLAGS="-static -L/openssl-static/lib -L/libnetfilter-acct-static/lib -lnetfilter_acct -L/usr/lib -lmnl"
# We export this to 'yes', installer sets this to .environment.
# The updater consumes this one, so that it can tell whether it should update a static install or a non-static one
@@ -20,7 +20,8 @@ export IS_NETDATA_STATIC_BINARY="yes"
# Set eBPF LIBC to "static" to bundle the `-static` variant of the kernel-collector
export EBPF_LIBC="static"
-export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig"
+export PKG_CONFIG="pkg-config --static"
+export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig:/libnetfilter-acct-static/lib/pkgconfig:/usr/lib/pkgconfig"
# Set correct CMake flags for building against non-System OpenSSL
# See: https://github.com/warmcat/libwebsockets/blob/master/READMEs/README.build.md