2121PREFIX=/opt/musl
2222mkdir -p " $PREFIX "
2323
24- toolchain_url=" https://musl.cc/${MUSL_TRIPLE} -native.tgz"
25- echo " setup-musl: downloading toolchain $toolchain_url "
26- curl -fsSL " $toolchain_url " | tar -xz -C " $PREFIX " --strip-components=1
24+ # Download a file, trying each mirror in turn with retries. musl.cc is chronic-
25+ # ally flaky (the first release run died on "connect to musl.cc timed out"), so
26+ # a GitHub-hosted mirror is tried first — GitHub is reliably reachable from CI.
27+ # `--retry-all-errors` is avoided on purpose: the manylinux_2_28 container ships
28+ # curl 7.61, which predates that flag. Plain `--retry` covers transient timeouts.
29+ fetch () {
30+ dest=" $1 " ; shift
31+ for url in " $@ " ; do
32+ echo " setup-musl: fetching $url "
33+ if curl -fL --retry 5 --retry-delay 3 --connect-timeout 20 --max-time 600 \
34+ -o " $dest " " $url " ; then
35+ return 0
36+ fi
37+ echo " setup-musl: mirror failed, trying next" >&2
38+ done
39+ echo " setup-musl: all mirrors failed for ${dest##*/ } " >&2
40+ return 1
41+ }
42+
43+ toolchain_tgz=" $( mktemp --suffix=.tgz) "
44+ fetch " $toolchain_tgz " \
45+ " https://github.com/musl-cc/musl.cc/releases/download/v0.0.1/${MUSL_TRIPLE} -native.tgz" \
46+ " https://musl.cc/${MUSL_TRIPLE} -native.tgz"
47+ tar -xzf " $toolchain_tgz " -C " $PREFIX " --strip-components=1
2748
2849export PATH=" $PREFIX /bin:$PATH "
2950echo " $PREFIX /bin" >> " $GITHUB_PATH "
@@ -33,7 +54,12 @@ echo "$PREFIX/bin" >> "$GITHUB_PATH"
3354ZLIB_VERSION=1.3.1
3455workdir=" $( mktemp -d) "
3556echo " setup-musl: building static zlib ${ZLIB_VERSION} with ${MUSL_TRIPLE} -gcc"
36- curl -fsSL " https://zlib.net/zlib-${ZLIB_VERSION} .tar.gz" | tar -xz -C " $workdir " --strip-components=1
57+ zlib_tgz=" $( mktemp --suffix=.tar.gz) "
58+ fetch " $zlib_tgz " \
59+ " https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION} /zlib-${ZLIB_VERSION} .tar.gz" \
60+ " https://zlib.net/zlib-${ZLIB_VERSION} .tar.gz" \
61+ " https://zlib.net/fossils/zlib-${ZLIB_VERSION} .tar.gz"
62+ tar -xzf " $zlib_tgz " -C " $workdir " --strip-components=1
3763(
3864 cd " $workdir "
3965 CC=" ${MUSL_TRIPLE} -gcc" ./configure --static --prefix=" $PREFIX "
0 commit comments