| 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 | |
| 9 | # shellcheck disable=SC2015 |
| 10 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building curl" || true |
| 11 | |
| 12 | cache_key="curl" |
| 13 | build_dir="${CURL_VERSION}" |
| 14 | |
| 15 | fetch_git "${build_dir}" "${CURL_SOURCE}" "${CURL_VERSION}" "${cache_key}" |
| 16 | |
| 17 | export CFLAGS="${TUNING_FLAGS} -I/openssl-static/include -pipe" |
| 18 | export CXXFLAGS="${CFLAGS}" |
| 19 | export LDFLAGS="-static -L/openssl-static/lib64" |
| 20 | export PKG_CONFIG="pkg-config --static" |
| 21 | export PKG_CONFIG_PATH="/openssl-static/lib64/pkgconfig" |
| 22 | |
| 23 | if [ "${CACHE_HIT:-0}" -eq 0 ]; then |
| 24 | run autoreconf -fi |
| 25 | |
| 26 | run ./configure \ |
| 27 | --prefix="/curl-local" \ |
| 28 | --enable-optimize \ |
| 29 | --disable-shared \ |
| 30 | --enable-static \ |
| 31 | --enable-http \ |
| 32 | --disable-ldap \ |
| 33 | --disable-ldaps \ |
| 34 | --enable-proxy \ |
| 35 | --disable-dict \ |
| 36 | --disable-telnet \ |
| 37 | --disable-tftp \ |
| 38 | --disable-pop3 \ |
| 39 | --disable-imap \ |
| 40 | --disable-smb \ |
| 41 | --disable-smtp \ |
| 42 | --disable-gopher \ |
| 43 | --enable-ipv6 \ |
| 44 | --enable-cookies \ |
| 45 | --with-ca-fallback \ |
| 46 | --with-openssl \ |
| 47 | --with-ca-bundle=/opt/netdata/etc/ssl/certs/ca-certificates.crt \ |
| 48 | --with-ca-path=/opt/netdata/etc/ssl/certs \ |
| 49 | --without-brotli \ |
| 50 | --disable-dependency-tracking |
| 51 | |
| 52 | # Curl autoconf does not honour the curl_LDFLAGS environment variable |
| 53 | run sed -i -e "s/LDFLAGS =/LDFLAGS = -all-static/" src/Makefile |
| 54 | |
| 55 | run make clean |
| 56 | run make -j "$(nproc)" |
| 57 | fi |
| 58 | |
| 59 | run make install |
| 60 | |
| 61 | store_cache "${cache_key}" "${build_dir}" |
| 62 | |
| 63 | cp /curl-local/bin/curl "${NETDATA_INSTALL_PATH}"/bin/curl |
| 64 | if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then |
| 65 | run strip "${NETDATA_INSTALL_PATH}"/bin/curl |
| 66 | fi |
| 67 | |
| 68 | # shellcheck disable=SC2015 |
| 69 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true |