diff --git a/packaging/makeself/bundled-packages.version b/packaging/makeself/bundled-packages.version index d6bec47e39..502974b656 100644 --- a/packaging/makeself/bundled-packages.version +++ b/packaging/makeself/bundled-packages.version @@ -3,6 +3,8 @@ PACKAGES=("OPENSSL" "CURL" "BASH" "IOPING" "LIBNETFILTER_ACT") SOURCE_TYPES=("GH_REPO_CLONE" "GH_REPO_CLONE" "DW_TARBALL" "GH_REPO_SOURCE" "DW_TARBALL") OPENSSL_VERSION="openssl-3.4.0" OPENSSL_SOURCE="https://github.com/openssl/openssl" +LIBUCONTEXT_VERSION="libucontext-1.3.2" +LIBUCONTEXT_SOURCE="https://github.com/kaniini/libucontext" LIBUNWIND_VERSION="177deb5f89c5d792c9618db54fdcebd260e271e8" # Should be updated to a stable version once https://github.com/libunwind/libunwind/issues/742 is fixed. LIBUNWIND_SOURCE="https://github.com/libunwind/libunwind" CURL_VERSION="curl-8_11_1" diff --git a/packaging/makeself/jobs/15-libucontext.install.sh b/packaging/makeself/jobs/15-libucontext.install.sh new file mode 100755 index 0000000000..ea7786d279 --- /dev/null +++ b/packaging/makeself/jobs/15-libucontext.install.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 +# Source of truth for all the packages we bundle in static builds +. "$(dirname "${0}")/../bundled-packages.version" +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building libucontext" || true + +export CFLAGS="${TUNING_FLAGS} -pipe" +export CXXFLAGS="${CFLAGS}" +export LDFLAGS="" + +if [ -d "${NETDATA_MAKESELF_PATH}/tmp/libucontext" ]; then + rm -rf "${NETDATA_MAKESELF_PATH}/tmp/libucontext" +fi + +cache="${NETDATA_SOURCE_PATH}/artifacts/cache/${BUILDARCH}/libucontext" + +if [ -d "${cache}" ]; then + echo "Found cached copy of build directory for libucontext, using it." + cp -a "${cache}/libucontext" "${NETDATA_MAKESELF_PATH}/tmp/" + CACHE_HIT=1 +else + echo "No cached copy of build directory for libucontext found, fetching sources instead." + run git clone --branch "${LIBUCONTEXT_VERSION}" --single-branch --depth 1 "${LIBUCONTEXT_SOURCE}" "${NETDATA_MAKESELF_PATH}/tmp/libucontext" + CACHE_HIT=0 +fi + +cd "${NETDATA_MAKESELF_PATH}/tmp/libucontext" || exit 1 + +case "${BUILDARCH}" in + armv6l|armv7l) arch=arm ;; + ppc64le) arch=ppc64 ;; + *) arch="${BUILDARCH}" ;; +esac + +if [ "${CACHE_HIT:-0}" -eq 0 ]; then + run make ARCH="${arch}" EXPORT_UNPREFIXED="yes" -j "$(nproc)" +fi + +run make ARCH="${arch}" EXPORT_UNPREFIXED="yes" DESTDIR="/libucontext-static" -j "$(nproc)" install + +store_cache libucontext "${NETDATA_MAKESELF_PATH}/tmp/libucontext" + +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true diff --git a/packaging/makeself/jobs/20-libunwind.install.sh b/packaging/makeself/jobs/20-libunwind.install.sh index 2f7260245f..676a7ce184 100755 --- a/packaging/makeself/jobs/20-libunwind.install.sh +++ b/packaging/makeself/jobs/20-libunwind.install.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash # SPDX-License-Identifier: GPL-3.0-or-later -# Can’t do libunwind on ppc64le with musl, so skip it. -[ "${BUILDARCH}" = "ppc64le" ] && exit 0 - # shellcheck source=packaging/makeself/functions.sh . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 # Source of truth for all the packages we bundle in static builds @@ -11,9 +8,9 @@ # shellcheck disable=SC2015 [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building libunwind" || true -export CFLAGS="${TUNING_FLAGS} -fno-lto -pipe" +export CFLAGS="${TUNING_FLAGS} -I/libucontext-static/usr/include -fno-lto -pipe" export CXXFLAGS="${CFLAGS}" -export LDFLAGS="-static" +export LDFLAGS="-static -L/libucontext-static/usr/lib/ -lucontext" export PKG_CONFIG="pkg-config --static" if [ -d "${NETDATA_MAKESELF_PATH}/tmp/libunwind" ]; then