Skip to content

Commit

Permalink
fix: 🐛 c-ares download
Browse files Browse the repository at this point in the history
  • Loading branch information
abcfy2 committed Jun 15, 2024
1 parent cc89a8d commit fa3e8f4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,19 @@ prepare_sqlite() {
}

prepare_c_ares() {
cares_tag="$(retry wget -qO- --compression=auto https://c-ares.org/ \| sed -nr "'s@.*<a href=\"/download/.*\">c-ares (.+)</a>.*@\1@p'")"
cares_latest_url="https://c-ares.org/download/c-ares-${cares_tag}.tar.gz"
# cares_latest_url="https://github.com/c-ares/c-ares/archive/main.tar.gz"
if [ ! -f "${DOWNLOADS_DIR}/c-ares-${cares_tag}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/c-ares-${cares_tag}.tar.gz.part" "${cares_latest_url}"
mv -fv "${DOWNLOADS_DIR}/c-ares-${cares_tag}.tar.gz.part" "${DOWNLOADS_DIR}/c-ares-${cares_tag}.tar.gz"
cares_latest_tag="$(retry wget -qO- --compression=auto https://api.github.com/repos/c-ares/c-ares/releases \| jq -r "'.[0].tag_name'")"
cares_ver="${cares_latest_tag#v}"
cares_latest_url="https://github.com/c-ares/c-ares/releases/download/${cares_latest_tag}/c-ares-${cares_ver}.tar.gz"
if [ x"${USE_CHINA_MIRROR}" = x1 ]; then
cares_latest_url="https://mirror.ghproxy.com/${cares_latest_url}"
fi
if [ ! -f "${DOWNLOADS_DIR}/c-ares-${cares_ver}.tar.gz" ]; then
retry wget -cT10 -O "${DOWNLOADS_DIR}/c-ares-${cares_ver}.tar.gz.part" "${cares_latest_url}"
mv -fv "${DOWNLOADS_DIR}/c-ares-${cares_ver}.tar.gz.part" "${DOWNLOADS_DIR}/c-ares-${cares_ver}.tar.gz"
fi
mkdir -p "/usr/src/c-ares-${cares_tag}"
tar -zxf "${DOWNLOADS_DIR}/c-ares-${cares_tag}.tar.gz" --strip-components=1 -C "/usr/src/c-ares-${cares_tag}"
cd "/usr/src/c-ares-${cares_tag}"
mkdir -p "/usr/src/c-ares-${cares_ver}"
tar -zxf "${DOWNLOADS_DIR}/c-ares-${cares_ver}.tar.gz" --strip-components=1 -C "/usr/src/c-ares-${cares_ver}"
cd "/usr/src/c-ares-${cares_ver}"
if [ ! -f "./configure" ]; then
autoreconf -i
fi
Expand Down

0 comments on commit fa3e8f4

Please sign in to comment.