mirror of
https://github.com/netdata/netdata.git
synced 2024-11-24 08:26:54 +00:00
48507277a3
To optimize the CI we are trying to cache build artifacts such as all the software we build and statically bundle for static binaries (for each arch) In a nutshell the artifacts of these https://github.com/netdata/netdata/tree/master/packaging/makeself/jobs source files. With this https://github.com/netdata/netdata/blob/master/.github/scripts/get-static-cache-key.sh script we generate the keys for these cached artifacts taking into account the (source files of the jobs, version of the software, static packages bundled in the base images). The effort #16303 to make a centralized file for all the versions expanded the problem of not considering the exact versions. Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud>
79 lines
2.3 KiB
Bash
Executable File
79 lines
2.3 KiB
Bash
Executable File
#!/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 cURL" || true
|
|
|
|
if [ -d "${NETDATA_MAKESELF_PATH}/tmp/curl" ]; then
|
|
rm -rf "${NETDATA_MAKESELF_PATH}/tmp/curl"
|
|
fi
|
|
|
|
cache="${NETDATA_SOURCE_PATH}/artifacts/cache/${BUILDARCH}/curl"
|
|
|
|
if [ -d "${cache}" ]; then
|
|
echo "Found cached copy of build directory for curl, using it."
|
|
cp -a "${cache}/curl" "${NETDATA_MAKESELF_PATH}/tmp/"
|
|
CACHE_HIT=1
|
|
else
|
|
echo "No cached copy of build directory for curl found, fetching sources instead."
|
|
run git clone --branch "${CURL_VERSION}" --single-branch --depth 1 "${CURL_SOURCE}" "${NETDATA_MAKESELF_PATH}/tmp/curl"
|
|
CACHE_HIT=0
|
|
fi
|
|
|
|
cd "${NETDATA_MAKESELF_PATH}/tmp/curl" || exit 1
|
|
|
|
export CFLAGS="-I/openssl-static/include -pipe"
|
|
export LDFLAGS="-static -L/openssl-static/lib64"
|
|
export PKG_CONFIG="pkg-config --static"
|
|
export PKG_CONFIG_PATH="/openssl-static/lib64/pkgconfig"
|
|
|
|
if [ "${CACHE_HIT:-0}" -eq 0 ]; then
|
|
run autoreconf -fi
|
|
|
|
run ./configure \
|
|
--prefix="/curl-local" \
|
|
--enable-optimize \
|
|
--disable-shared \
|
|
--enable-static \
|
|
--enable-http \
|
|
--disable-ldap \
|
|
--disable-ldaps \
|
|
--enable-proxy \
|
|
--disable-dict \
|
|
--disable-telnet \
|
|
--disable-tftp \
|
|
--disable-pop3 \
|
|
--disable-imap \
|
|
--disable-smb \
|
|
--disable-smtp \
|
|
--disable-gopher \
|
|
--enable-ipv6 \
|
|
--enable-cookies \
|
|
--with-ca-fallback \
|
|
--with-openssl \
|
|
--disable-dependency-tracking
|
|
|
|
# Curl autoconf does not honour the curl_LDFLAGS environment variable
|
|
run sed -i -e "s/LDFLAGS =/LDFLAGS = -all-static/" src/Makefile
|
|
|
|
run make clean
|
|
run make -j "$(nproc)"
|
|
fi
|
|
|
|
run make install
|
|
|
|
store_cache curl "${NETDATA_MAKESELF_PATH}/tmp/curl"
|
|
|
|
cp /curl-local/bin/curl "${NETDATA_INSTALL_PATH}"/bin/curl
|
|
if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
|
|
run strip "${NETDATA_INSTALL_PATH}"/bin/curl
|
|
fi
|
|
|
|
# shellcheck disable=SC2015
|
|
[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true
|