mirror of
https://github.com/netdata/netdata.git
synced 2025-04-10 08:07:34 +00:00
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>
This commit is contained in:
parent
4c20aca875
commit
513452aa44
4 changed files with 68 additions and 18 deletions
configure.ac
packaging/makeself
31
configure.ac
31
configure.ac
|
@ -952,17 +952,8 @@ AC_CHECK_HEADER(
|
|||
[have_nfnetlink_conntrack=no]
|
||||
)
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
[NFACCT],
|
||||
[libnetfilter_acct],
|
||||
[AC_CHECK_LIB(
|
||||
[netfilter_acct],
|
||||
[nfacct_alloc],
|
||||
[have_libnetfilter_acct=yes],
|
||||
[have_libnetfilter_acct=no]
|
||||
)],
|
||||
[have_libnetfilter_acct=no]
|
||||
)
|
||||
LIBS_BAK="${LIBS}"
|
||||
LIBS="${LIBS} -lmnl"
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
[LIBMNL],
|
||||
|
@ -976,6 +967,24 @@ PKG_CHECK_MODULES(
|
|||
[have_libmnl=no]
|
||||
)
|
||||
|
||||
|
||||
LIBS="${LIBS}"
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
[NFACCT],
|
||||
[libnetfilter_acct],
|
||||
AC_SEARCH_LIBS(
|
||||
[nfacct_alloc],
|
||||
[netfilter_acct libnetfilter_acct],
|
||||
[have_libnetfilter_acct=yes],
|
||||
[have_libnetfilter_acct=no],
|
||||
[${LIBS} -L/libnetfilter-acct-static/lib/libnetfilter_acct.a]
|
||||
)],
|
||||
[have_libnetfilter_acct=no]
|
||||
)
|
||||
|
||||
LIBS="${LIBS_BAK}"
|
||||
|
||||
test "${enable_plugin_nfacct}" = "yes" -a "${have_nfnetlink_conntrack}" != "yes" && \
|
||||
AC_MSG_ERROR([nfnetlink_conntrack.h required but not found or too old])
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
39
packaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh
Executable file
39
packaging/makeself/jobs/50-libnetfilter_acct-1.0.3.install.sh
Executable file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue