| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | |
| 4 | # shellcheck source=packaging/makeself/functions.sh |
| 5 | . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 |
| 6 | # Source of truth for all the packages we bundle in static builds |
| 7 | . "$(dirname "${0}")/../bundled-packages.version" |
| 8 | # shellcheck disable=SC2015 |
| 9 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building OpenSSL" || true |
| 10 | |
| 11 | export CFLAGS="${TUNING_FLAGS} -fno-lto -pipe" |
| 12 | export CXXFLAGS="${CFLAGS}" |
| 13 | export LDFLAGS="-static" |
| 14 | export PKG_CONFIG="pkg-config --static" |
| 15 | |
| 16 | cache_key="openssl" |
| 17 | build_dir="${OPENSSL_VERSION}" |
| 18 | |
| 19 | fetch_git "${build_dir}" "${OPENSSL_SOURCE}" "${OPENSSL_VERSION}" "${cache_key}" |
| 20 | |
| 21 | if [ "${CACHE_HIT:-0}" -eq 0 ]; then |
| 22 | COMMON_CONFIG="-static threads no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl" |
| 23 | |
| 24 | sed -i "s/disable('static', 'pic', 'threads');/disable('static', 'pic');/" Configure |
| 25 | |
| 26 | # shellcheck disable=SC2086 |
| 27 | case "${BUILDARCH}" in |
| 28 | armv6l|armv7l) run ./config ${COMMON_CONFIG} linux-armv4 ;; |
| 29 | *) run ./config ${COMMON_CONFIG} ;; |
| 30 | esac |
| 31 | |
| 32 | run make -j "$(nproc)" |
| 33 | fi |
| 34 | |
| 35 | run make -j "$(nproc)" install_sw |
| 36 | |
| 37 | if [ -d "/openssl-static/lib" ]; then |
| 38 | cd "/openssl-static" || exit 1 |
| 39 | ln -s "lib" "lib64" || true |
| 40 | cd - || exit 1 |
| 41 | fi |
| 42 | |
| 43 | store_cache "${cache_key}" "${build_dir}" |
| 44 | |
| 45 | perl configdata.pm --dump |
| 46 | |
| 47 | # shellcheck disable=SC2015 |
| 48 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true |