From 100e2449f7061f3cd6b13aec9fa863b888600878 Mon Sep 17 00:00:00 2001 From: Divam Date: Tue, 7 May 2024 20:11:51 +0900 Subject: [PATCH] Move the GHCUP_MSYS2_ENV_DIR setup code, invoke it on windows platforms only Fixes the bootstrap on armv7* $ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh Unknown architecture: armv7l --- scripts/bootstrap/bootstrap-haskell | 63 +++++++++++++++-------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/scripts/bootstrap/bootstrap-haskell b/scripts/bootstrap/bootstrap-haskell index a684ba25..19877c97 100755 --- a/scripts/bootstrap/bootstrap-haskell +++ b/scripts/bootstrap/bootstrap-haskell @@ -45,12 +45,45 @@ ghver="0.1.22.0" export GHCUP_SKIP_UPDATE_CHECK=yes : "${BOOTSTRAP_HASKELL_DOWNLOADER:=curl}" +set_msys2_env_dir() { + case "${GHCUP_MSYS2_ENV}" in + "") + case "${arch}" in + x86_64|amd64) + GHCUP_MSYS2_ENV_DIR="mingw64" ;; + i*86) + GHCUP_MSYS2_ENV_DIR="mingw32" ;; + aarch64|arm64) + GHCUP_MSYS2_ENV_DIR="clangarm64" ;; + *) die "Unknown architecture: ${arch}" ;; + esac + ;; + MSYS) + GHCUP_MSYS2_ENV_DIR="usr" ;; + UCRT64) + GHCUP_MSYS2_ENV_DIR="ucrt64" ;; + CLANG64) + GHCUP_MSYS2_ENV_DIR="clang64" ;; + CLANGARM64) + GHCUP_MSYS2_ENV_DIR="clangarm64" ;; + CLANG32) + GHCUP_MSYS2_ENV_DIR="clang32" ;; + MINGW64) + GHCUP_MSYS2_ENV_DIR="mingw64" ;; + MINGW32) + GHCUP_MSYS2_ENV_DIR="mingw32" ;; + *) + die "Invalid value for GHCUP_MSYS2_ENV. Valid values are: MSYS, UCRT64, CLANG64, CLANGARM64, CLANG32, MINGW64, MINGW32" ;; + esac +} + case "${plat}" in MSYS*|MINGW*|CYGWIN*) : "${GHCUP_INSTALL_BASE_PREFIX:=/c}" GHCUP_DIR=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup") GHCUP_BIN=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin") : "${GHCUP_MSYS2:=${GHCUP_DIR}/msys64}" + set_msys2_env_dir ;; *) : "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}" @@ -65,36 +98,6 @@ case "${plat}" in ;; esac -case "${GHCUP_MSYS2_ENV}" in - "") - case "${arch}" in - x86_64|amd64) - GHCUP_MSYS2_ENV_DIR="mingw64" ;; - i*86) - GHCUP_MSYS2_ENV_DIR="mingw32" ;; - aarch64|arm64) - GHCUP_MSYS2_ENV_DIR="clangarm64" ;; - *) die "Unknown architecture: ${arch}" ;; - esac - ;; - MSYS) - GHCUP_MSYS2_ENV_DIR="usr" ;; - UCRT64) - GHCUP_MSYS2_ENV_DIR="ucrt64" ;; - CLANG64) - GHCUP_MSYS2_ENV_DIR="clang64" ;; - CLANGARM64) - GHCUP_MSYS2_ENV_DIR="clangarm64" ;; - CLANG32) - GHCUP_MSYS2_ENV_DIR="clang32" ;; - MINGW64) - GHCUP_MSYS2_ENV_DIR="mingw64" ;; - MINGW32) - GHCUP_MSYS2_ENV_DIR="mingw32" ;; - *) - die "Invalid value for GHCUP_MSYS2_ENV. Valid values are: MSYS, UCRT64, CLANG64, CLANGARM64, CLANG32, MINGW64, MINGW32" ;; -esac - : "${BOOTSTRAP_HASKELL_GHC_VERSION:=recommended}" : "${BOOTSTRAP_HASKELL_CABAL_VERSION:=recommended}"