| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | |
| 4 | # shellcheck source=./packaging/makeself/functions.sh |
| 5 | . "${NETDATA_MAKESELF_PATH}"/functions.sh "${@}" || exit 1 |
| 6 | |
| 7 | cd "${NETDATA_SOURCE_PATH}" || exit 1 |
| 8 | |
| 9 | if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then |
| 10 | export CFLAGS="${TUNING_FLAGS} -O2 -pipe -funroll-loops -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/curl-local/include/curl -I/usr/include/libmnl" |
| 11 | else |
| 12 | export CFLAGS="${TUNING_FLAGS} -O1 -pipe -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/curl-local/include/curl -I/usr/include/libmnl" |
| 13 | fi |
| 14 | |
| 15 | export LDFLAGS="-Wl,--gc-sections -L/openssl-static/lib64 -L/libnetfilter-acct-static/lib -lnetfilter_acct -L/usr/lib -lmnl -L/usr/lib -lzstd -L/curl-local/lib" |
| 16 | export PKG_CONFIG_PATH="/openssl-static/lib64/pkgconfig:/libnetfilter-acct-static/lib/pkgconfig:/usr/lib/pkgconfig:/curl-local/lib/pkgconfig" |
| 17 | |
| 18 | # We export this to 'yes', installer sets this to .environment. |
| 19 | # The updater consumes this one, so that it can tell whether it should update a static install or a non-static one |
| 20 | export IS_NETDATA_STATIC_BINARY="yes" |
| 21 | |
| 22 | NETDATA_BUILD_DIR="$(build_path netdata)" |
| 23 | export NETDATA_BUILD_DIR |
| 24 | |
| 25 | # Needed to make Rust play nice with our static builds |
| 26 | # Once Cargo's profile-rustflags feature is a bit more widespread, we should switch to using that to specify this. |
| 27 | export RUSTFLAGS="-C target-feature=+crt-static" |
| 28 | |
| 29 | case "${BUILDARCH}" in |
| 30 | armv6l) |
| 31 | export NETDATA_CMAKE_OPTIONS="-DSTATIC_BUILD=On -DENABLE_LIBBACKTRACE=On" |
| 32 | export INSTALLER_ARGS="--disable-plugin-systemd-journal --disable-plugin-otel --disable-plugin-otel-signal-viewer" |
| 33 | ;; |
| 34 | *) |
| 35 | export NETDATA_CMAKE_OPTIONS="-DSTATIC_BUILD=On -DENABLE_LIBBACKTRACE=On" |
| 36 | export INSTALLER_ARGS="--enable-plugin-systemd-journal --internal-systemd-journal --enable-plugin-otel --enable-plugin-otel-signal-viewer" |
| 37 | ;; |
| 38 | esac |
| 39 | |
| 40 | run ./netdata-installer.sh \ |
| 41 | --install-prefix "${NETDATA_INSTALL_PARENT}" \ |
| 42 | --dont-wait \ |
| 43 | --dont-start-it \ |
| 44 | --disable-exporting-mongodb \ |
| 45 | --dont-scrub-cflags-even-though-it-may-break-things \ |
| 46 | --one-time-build \ |
| 47 | --enable-lto \ |
| 48 | ${INSTALLER_ARGS:+${INSTALLER_ARGS}} \ |
| 49 | ${EXTRA_INSTALL_FLAGS:+${EXTRA_INSTALL_FLAGS}} \ |