Support cygwin in bootstrap-haskell too

Fixes #958
This commit is contained in:
Julian Ospald 2023-12-29 19:56:38 +08:00
parent df192ee18e
commit c680a9f33b
No known key found for this signature in database
GPG Key ID: 4275CDA6A29BED43

View File

@ -35,7 +35,7 @@ export GHCUP_SKIP_UPDATE_CHECK=yes
: "${BOOTSTRAP_HASKELL_DOWNLOADER:=curl}" : "${BOOTSTRAP_HASKELL_DOWNLOADER:=curl}"
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
: "${GHCUP_INSTALL_BASE_PREFIX:=/c}" : "${GHCUP_INSTALL_BASE_PREFIX:=/c}"
GHCUP_DIR=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup") GHCUP_DIR=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup")
GHCUP_BIN=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin") GHCUP_BIN=$(cygpath -u "${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin")
@ -72,7 +72,7 @@ warn() {
printf "%s\\n" "$1" printf "%s\\n" "$1"
else else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
# shellcheck disable=SC3037 # shellcheck disable=SC3037
echo -e "\\033[0;35m$1\\033[0m" echo -e "\\033[0;35m$1\\033[0m"
;; ;;
@ -88,7 +88,7 @@ yellow() {
printf "%s\\n" "$1" printf "%s\\n" "$1"
else else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
# shellcheck disable=SC3037 # shellcheck disable=SC3037
echo -e "\\033[0;33m$1\\033[0m" echo -e "\\033[0;33m$1\\033[0m"
;; ;;
@ -104,7 +104,7 @@ green() {
printf "%s\\n" "$1" printf "%s\\n" "$1"
else else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
# shellcheck disable=SC3037 # shellcheck disable=SC3037
echo -e "\\033[0;32m$1\\033[0m" echo -e "\\033[0;32m$1\\033[0m"
;; ;;
@ -160,7 +160,7 @@ _done() {
echo echo
echo "===============================================================================" echo "==============================================================================="
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
green green
green "All done!" green "All done!"
green green
@ -313,7 +313,7 @@ download_ghcup() {
;; ;;
esac esac
;; ;;
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
case "${arch}" in case "${arch}" in
x86_64|amd64) x86_64|amd64)
_url=${GHCUP_BASE_URL}/${ghver}/x86_64-mingw64-ghcup-${ghver}.exe _url=${GHCUP_BASE_URL}/${ghver}/x86_64-mingw64-ghcup-${ghver}.exe
@ -326,7 +326,7 @@ download_ghcup() {
;; ;;
esac esac
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
case "${BOOTSTRAP_HASKELL_DOWNLOADER}" in case "${BOOTSTRAP_HASKELL_DOWNLOADER}" in
"curl") "curl")
# shellcheck disable=SC2086 # shellcheck disable=SC2086
@ -545,7 +545,7 @@ adjust_bashrc() {
printf "\n%s" "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile" printf "\n%s" "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile"
fi fi
;; ;;
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
if [ ! -e "${HOME}/.bash_profile" ] ; then if [ ! -e "${HOME}/.bash_profile" ] ; then
echo '# generated by ghcup' > "${HOME}/.bash_profile" echo '# generated by ghcup' > "${HOME}/.bash_profile"
echo 'test -f ~/.profile && . ~/.profile' >> "${HOME}/.bash_profile" echo 'test -f ~/.profile && . ~/.profile' >> "${HOME}/.bash_profile"
@ -595,7 +595,7 @@ adjust_cabal_config() {
ask_cabal_config_init() { ask_cabal_config_init() {
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG}" ] ; then if [ -n "${BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG}" ] ; then
return 1 return 1
fi fi
@ -636,7 +636,7 @@ ask_cabal_config_init() {
do_cabal_config_init() { do_cabal_config_init() {
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
case $1 in case $1 in
1) 1)
adjust_cabal_config adjust_cabal_config
@ -756,7 +756,7 @@ if [ -z "${GHCUP_USE_XDG_DIRS}" ] ; then
echo "ghcup installs only into the following directory," echo "ghcup installs only into the following directory,"
echo "which can be removed anytime:" echo "which can be removed anytime:"
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
echo " $(cygpath -w "$GHCUP_DIR")" echo " $(cygpath -w "$GHCUP_DIR")"
;; ;;
*) *)
@ -823,7 +823,7 @@ if [ -z "${BOOTSTRAP_HASKELL_MINIMAL}" ] ; then
edo cabal update --ignore-project edo cabal update --ignore-project
else # don't install ghc and cabal else # don't install ghc and cabal
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*|CYGWIN*)
# need to bootstrap cabal to initialize config on windows # need to bootstrap cabal to initialize config on windows
# we'll remove it afterwards # we'll remove it afterwards
tmp_dir="$(mktemp -d)" tmp_dir="$(mktemp -d)"