summaryrefslogtreecommitdiff
path: root/mk/get-win32-tarballs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mk/get-win32-tarballs.sh')
-rwxr-xr-xmk/get-win32-tarballs.sh64
1 files changed, 42 insertions, 22 deletions
diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh
index 7f3b544904..32f27059c7 100755
--- a/mk/get-win32-tarballs.sh
+++ b/mk/get-win32-tarballs.sh
@@ -1,8 +1,11 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
tarball_dir='ghc-tarballs'
missing_files=0
+# see #12502
+if test -z "$FIND"; then FIND="find"; fi
+
fail() {
echo >&2
echo "$1" >&2
@@ -19,11 +22,11 @@ download_file() {
if ! test -f "${dest_file}"
then
- local curl_cmd="curl -L ${file_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
+ local curl_cmd="curl -f -L ${file_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
if test -n "${backup_url}"; then
- local curl_cmd_bnk="curl -L ${backup_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
+ local curl_cmd_bnk="curl -f -L ${backup_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
else
- local curl_cmd_bnk="echo 1"
+ local curl_cmd_bnk="true"
fi
if test "$download" = "0"
@@ -34,9 +37,10 @@ download_file() {
return
else
echo "Downloading ${description} to ${dest_dir}..."
- $curl_cmd || $curl_cmd_bnk || {
+ $curl_cmd || echo "Checking repo.msys2.org instead of Haskell.org..." && $curl_cmd_bnk || {
rm -f "${dest_file}"
fail "ERROR: Download failed."
+ exit 1
}
fi
fi
@@ -45,10 +49,16 @@ download_file() {
if test "$sigs" = "1" -a ! -f "$sig_file"
then
echo "Downloading ${description} (signature) to ${dest_dir}..."
- local curl_cmd="curl -L ${file_url}.sig -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
- $curl_cmd || {
+ local curl_cmd="curl -f -L ${file_url}.sig -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
+ if test -n "${backup_url}"; then
+ local curl_cmd_bnk="curl -f -L ${backup_url} -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
+ else
+ local curl_cmd_bnk="true"
+ fi
+ $curl_cmd || echo "Checking repo.msys2.org instead of Haskell.org..." && $curl_cmd_bnk || {
rm -f "${dest_file}.sig"
fail "ERROR: Download failed."
+ exit 1
}
fi
@@ -69,6 +79,7 @@ download_mingw() {
-e 's/-sources-/-/' \
-e 's/-libwinpthread-git-/-winpthreads-git-/' `
local mingw_url="${mingw_base_url_primary}/${mingw_url_tmp}"
+ local mingw_url_backup="${mingw_base_url_secondary}/${mingw_url_tmp}"
else
local mingw_url="${mingw_base_url_primary}/$1"
local mingw_url_backup="${mingw_base_url_secondary}/$1"
@@ -91,29 +102,28 @@ download_tarballs() {
local format_url="/${mingw_arch}/${package_prefix}-${mingw_arch}"
download_mingw "${format_url}-crt-git-5.0.0.4795.e3d96cb1-1-any.pkg.tar.xz"
- download_mingw "${format_url}-winpthreads-git-5.0.0.4761.02bea78-1-any.pkg.tar.xz"
- download_mingw "${format_url}-headers-git-5.0.0.4797.31e66d7e-1-any.pkg.tar.xz"
- download_mingw "${format_url}-libwinpthread-git-5.0.0.4761.02bea78-1-any.pkg.tar.xz"
- download_mingw "${format_url}-zlib-1.2.11-1-any.pkg.tar.xz"
- download_mingw "${format_url}-isl-0.17.1-1-any.pkg.tar.xz"
- download_mingw "${format_url}-mpfr-3.1.5.p1-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-winpthreads-git-5.0.0.4850.d1662dc7-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-headers-git-5.0.0.4966.1eee2140-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-libwinpthread-git-5.0.0.4850.d1662dc7-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-zlib-1.2.8-9-any.pkg.tar.xz"
+ download_mingw "${format_url}-isl-0.18-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-mpfr-3.1.6-1-any.pkg.tar.xz"
download_mingw "${format_url}-gmp-6.1.2-1-any.pkg.tar.xz"
- download_mingw "${format_url}-binutils-2.28-1-any.pkg.tar.xz"
- download_mingw "${format_url}-libidn-1.33-1-any.pkg.tar.xz"
- download_mingw "${format_url}-gcc-6.3.0-2-any.pkg.tar.xz"
+ download_mingw "${format_url}-binutils-2.29.1-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-libidn2-2.0.4-1-any.pkg.tar.xz"
+ download_mingw "${format_url}-gcc-7.2.0-1-any.pkg.tar.xz"
# Upstream is unfortunately quite inconsistent in naming
if test "$mingw_arch" != "sources"; then
download_mingw "${format_url}-mpc-1.0.3-2-any.pkg.tar.xz"
- download_mingw "${format_url}-gcc-libs-6.3.0-2-any.pkg.tar.xz"
+ download_mingw "${format_url}-gcc-libs-7.2.0-1-any.pkg.tar.xz"
+ download_file "https://downloads.haskell.org/~ghc/mingw/ghc-perl-1.tar.gz" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" "" ""
else
local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}"
download_mingw "${format_url}-i686-mpc-1.0.3-2.src.tar.gz"
download_mingw "${format_url}-x86_64-mpc-1.0.3-2.src.tar.gz"
fi
- download_file "https://downloads.haskell.org/~ghc/mingw/ghc-perl-1.tar.gz" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions"
-
if ! test "$missing_files" = "0"
then
exit 2
@@ -148,20 +158,24 @@ sync_binaries_and_sources() {
verify=0
download_sources
- for f in $(find ghc-tarballs/mingw-w64 -iname '*.sig'); do
+ for f in $($FIND ghc-tarballs/mingw-w64 -iname '*.sig'); do
echo "Verifying $f"
gpg --verify $f
done
- md5sum `find ghc-tarballs -type f -a -not -iname '*.sig'` >| mk/win32-tarballs.md5sum
+ md5sum `$FIND ghc-tarballs -type f -a -not -iname '*.sig'` >| mk/win32-tarballs.md5sum
chmod -R ugo+rX ghc-tarballs
rsync -av ghc-tarballs/mingw-w64/* downloads.haskell.org:public_html/mingw
- for f in $(find ghc-tarballs/mingw-w64); do
+ for f in $($FIND ghc-tarballs/mingw-w64); do
curl -XPURGE http://downloads.haskell.org/~ghc/mingw/$f
done
}
+show_hashes_for_binaries() {
+ $FIND ghc-tarballs/ -iname "*.*" | xargs md5sum | grep -v "\.sig" | sed -s "s/\*//"
+}
+
usage() {
echo "$0 - Download GHC mingw toolchain tarballs"
echo
@@ -172,6 +186,7 @@ usage() {
echo " download download the necessary tarballs for the given architecture"
echo " fetch download the necessary tarballs for the given architecture but doesn't verify their md5."
echo " verify verify the existence and correctness of the necessary tarballs"
+ echo " hash generate md5 hashes for inclusion in win32-tarballs.md5sum"
echo " sync upload packages downloaded with 'fetch mirror' to haskell.org"
echo ""
echo "and <arch> is one of i386, x86_64,all or mirror (which includes sources)"
@@ -196,6 +211,10 @@ case $1 in
verify=0
sync=1
;;
+ hash)
+ show_hashes_for_binaries
+ exit 1
+ ;;
*)
usage
exit 1
@@ -219,6 +238,7 @@ case $2 in
download_x86_64
verify=0
download_sources
+ show_hashes_for_binaries
;;
*)
if test "$sync" = "1"; then