50-curl.install.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. # shellcheck source=packaging/makeself/functions.sh
  4. . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
  5. # Source of truth for all the packages we bundle in static builds
  6. . "$(dirname "${0}")/../bundled-packages.version"
  7. # shellcheck disable=SC2015
  8. [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building cURL" || true
  9. if [ -d "${NETDATA_MAKESELF_PATH}/tmp/curl" ]; then
  10. rm -rf "${NETDATA_MAKESELF_PATH}/tmp/curl"
  11. fi
  12. cache="${NETDATA_SOURCE_PATH}/artifacts/cache/${BUILDARCH}/curl"
  13. if [ -d "${cache}" ]; then
  14. echo "Found cached copy of build directory for curl, using it."
  15. cp -a "${cache}/curl" "${NETDATA_MAKESELF_PATH}/tmp/"
  16. CACHE_HIT=1
  17. else
  18. echo "No cached copy of build directory for curl found, fetching sources instead."
  19. run git clone --branch "${CURL_VERSION}" --single-branch --depth 1 "${CURL_SOURCE}" "${NETDATA_MAKESELF_PATH}/tmp/curl"
  20. CACHE_HIT=0
  21. fi
  22. cd "${NETDATA_MAKESELF_PATH}/tmp/curl" || exit 1
  23. export CFLAGS="-I/openssl-static/include -pipe"
  24. export LDFLAGS="-static -L/openssl-static/lib64"
  25. export PKG_CONFIG="pkg-config --static"
  26. export PKG_CONFIG_PATH="/openssl-static/lib64/pkgconfig"
  27. if [ "${CACHE_HIT:-0}" -eq 0 ]; then
  28. run autoreconf -fi
  29. run ./configure \
  30. --prefix="/curl-local" \
  31. --enable-optimize \
  32. --disable-shared \
  33. --enable-static \
  34. --enable-http \
  35. --disable-ldap \
  36. --disable-ldaps \
  37. --enable-proxy \
  38. --disable-dict \
  39. --disable-telnet \
  40. --disable-tftp \
  41. --disable-pop3 \
  42. --disable-imap \
  43. --disable-smb \
  44. --disable-smtp \
  45. --disable-gopher \
  46. --enable-ipv6 \
  47. --enable-cookies \
  48. --with-ca-fallback \
  49. --with-openssl \
  50. --disable-dependency-tracking
  51. # Curl autoconf does not honour the curl_LDFLAGS environment variable
  52. run sed -i -e "s/LDFLAGS =/LDFLAGS = -all-static/" src/Makefile
  53. run make clean
  54. run make -j "$(nproc)"
  55. fi
  56. run make install
  57. store_cache curl "${NETDATA_MAKESELF_PATH}/tmp/curl"
  58. cp /curl-local/bin/curl "${NETDATA_INSTALL_PATH}"/bin/curl
  59. if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then
  60. run strip "${NETDATA_INSTALL_PATH}"/bin/curl
  61. fi
  62. # shellcheck disable=SC2015
  63. [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true