summaryrefslogtreecommitdiffstats
path: root/packaging/makeself/jobs/20-openssl.install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/makeself/jobs/20-openssl.install.sh')
-rwxr-xr-xpackaging/makeself/jobs/20-openssl.install.sh31
1 files changed, 26 insertions, 5 deletions
diff --git a/packaging/makeself/jobs/20-openssl.install.sh b/packaging/makeself/jobs/20-openssl.install.sh
index 96d53fc8..5d9aa068 100755
--- a/packaging/makeself/jobs/20-openssl.install.sh
+++ b/packaging/makeself/jobs/20-openssl.install.sh
@@ -9,19 +9,40 @@
version="$(cat "$(dirname "${0}")/../openssl.version")"
-export CFLAGS='-fno-lto'
+export CFLAGS='-fno-lto -pipe'
export LDFLAGS='-static'
export PKG_CONFIG="pkg-config --static"
-# Might be bind-mounted
-if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then
+if [ -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then
+ rm -rf "${NETDATA_MAKESELF_PATH}/tmp/openssl"
+fi
+
+if [ -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then
+ rm -rf "${NETDATA_MAKESELF_PATH}/tmp/openssl"
+fi
+
+cache="${NETDATA_SOURCE_PATH}/artifacts/cache/${BUILDARCH}/openssl"
+
+if [ -d "${cache}" ]; then
+ echo "Found cached copy of build directory for openssl, using it."
+ cp -a "${cache}/openssl" "${NETDATA_MAKESELF_PATH}/tmp/"
+ CACHE_HIT=1
+else
+ echo "No cached copy of build directory for openssl found, fetching sources instead."
run git clone --branch "${version}" --single-branch --depth 1 git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl"
+ CACHE_HIT=0
fi
+
cd "${NETDATA_MAKESELF_PATH}/tmp/openssl" || exit 1
-run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
-run make -j "$(nproc)"
+if [ "${CACHE_HIT:-0}" -eq 0 ]; then
+ run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
+ run make -j "$(nproc)"
+fi
+
run make -j "$(nproc)" install_sw
+store_cache openssl "${NETDATA_MAKESELF_PATH}/tmp/openssl"
+
# shellcheck disable=SC2015
[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true