Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b4fcd05e8f
|
|||
|
1345ec938b
|
|||
|
227f3acaa5
|
|||
|
c20636f597
|
|||
|
c2d437150a
|
|||
|
9ff1467612
|
|||
|
9218efd71a
|
|||
|
bcd244a92a
|
|||
|
7de552ed82
|
|||
|
5cf297a4d2
|
|||
|
d86f84eef4
|
|||
|
83458c6c1e
|
|||
|
b862ca52a9
|
|||
|
e8d79c9d38
|
|||
|
59e1eee8ce
|
|||
|
57c8ffda35
|
|||
|
171ebd213d
|
|||
|
2a240cbd09
|
|||
|
068fa3454c
|
|||
|
6b2bcbf2ce
|
|||
|
19e46dac18
|
|||
|
e96c863120
|
|||
|
a30b3c84d7
|
|||
|
0ad5dc4583
|
|||
|
7189998f3b
|
|||
|
b6b24b8e0b
|
|||
|
8e820c6e89
|
|||
|
c74784a37c
|
|||
|
3d940cffcf
|
|||
|
0df044b284
|
|||
|
f576b9fb20
|
|||
|
5e00264119
|
|||
|
|
05eeba32fa | ||
|
|
61019ecd49 | ||
|
|
bed06d1334 | ||
|
|
f09f4bd1b7 | ||
|
|
a3b11f21bb | ||
|
|
69a461d9c3 | ||
|
|
1dfe5cfecf | ||
|
|
8e4550657e | ||
|
|
aee7fa52c3 | ||
|
|
d166cc84a1 | ||
|
|
bb7229d224 | ||
|
|
708cd5ead9 | ||
|
|
f7986cb4da | ||
|
|
395aeb415d | ||
|
|
830fb70492 | ||
|
|
6379a26afb | ||
|
|
2277013c76 | ||
|
|
8934e0e6bd | ||
|
|
59519febbc | ||
|
|
46fcdd356c | ||
|
|
9f343c45e8 | ||
|
|
931904f388 | ||
|
|
a40d0cbb5c | ||
|
|
9f5df9db10 | ||
|
|
d26ddf7015 | ||
|
|
9515065407 | ||
|
|
82a8c61cf6 | ||
|
|
3fae516ce4 | ||
|
|
33eaa765d7 | ||
|
|
3b3dde8413 | ||
|
|
118a2744fe | ||
|
|
2e3dceecf8 | ||
|
|
07fb04bb74 | ||
|
|
8a1dbe9dbb | ||
|
|
4ef3622616 | ||
|
|
82a704ab44 | ||
|
|
0cb22945fe | ||
|
|
d09adf9159 | ||
|
|
0b959c56fb | ||
|
|
ec29332657 | ||
|
|
0f6381e67b | ||
|
|
877b55e21d | ||
|
|
fa11ca665f | ||
|
d9d196439f
|
|||
|
a34fc4ad4f
|
|||
|
b4d52b88c1
|
|||
|
3fc3d27361
|
|||
|
56b86add38
|
@@ -7,7 +7,7 @@ variables:
|
|||||||
GIT_SSL_NO_VERIFY: "1"
|
GIT_SSL_NO_VERIFY: "1"
|
||||||
|
|
||||||
# Commit of ghc/ci-images repository from which to pull Docker images
|
# Commit of ghc/ci-images repository from which to pull Docker images
|
||||||
DOCKER_REV: 1ac7f435c9312f10422a82d304194778378e2a1a
|
DOCKER_REV: 8d0224e6b2a08157649651e69302380b2bd24e11
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# CI Step
|
# CI Step
|
||||||
@@ -41,7 +41,7 @@ variables:
|
|||||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||||
|
|
||||||
.linux:armv7:
|
.linux:armv7:
|
||||||
image: "arm32v7/fedora"
|
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
|
||||||
tags:
|
tags:
|
||||||
- armv7-linux
|
- armv7-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -50,7 +50,7 @@ variables:
|
|||||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||||
|
|
||||||
.linux:aarch64:
|
.linux:aarch64:
|
||||||
image: "arm64v8/fedora"
|
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
|
||||||
tags:
|
tags:
|
||||||
- aarch64-linux
|
- aarch64-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -124,14 +124,14 @@ variables:
|
|||||||
- .test_ghcup_version
|
- .test_ghcup_version
|
||||||
- .linux:armv7
|
- .linux:armv7
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
|
|
||||||
.test_ghcup_version:aarch64:
|
.test_ghcup_version:aarch64:
|
||||||
extends:
|
extends:
|
||||||
- .test_ghcup_version
|
- .test_ghcup_version
|
||||||
- .linux:aarch64
|
- .linux:aarch64
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
|
|
||||||
.test_ghcup_version:darwin:
|
.test_ghcup_version:darwin:
|
||||||
extends:
|
extends:
|
||||||
@@ -149,17 +149,19 @@ variables:
|
|||||||
script: |
|
script: |
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
function runInNixShell() {
|
function runInNixShell() {
|
||||||
time nix-shell .gitlab/shell.nix \
|
time nix-shell $CI_PROJECT_DIR/.gitlab/shell.nix \
|
||||||
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
||||||
--argstr system "x86_64-darwin" \
|
--argstr system "aarch64-darwin" \
|
||||||
--pure \
|
--pure \
|
||||||
--keep GHC_VERSION --keep CABAL_INSTALL_VERSION --keep BUILD_FLAVOUR \
|
--keep CI_PROJECT_DIR \
|
||||||
--keep BIN_DIST_PREP_TAR_COMP --keep CPUS --keep PROJECT_DIR \
|
--keep MACOSX_DEPLOYMENT_TARGET \
|
||||||
--keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \
|
--keep JSON_VERSION \
|
||||||
--keep LANG --keep CONFIGURE_ARGS --keep TEST_ENV --keep BIN_DIST_NAME \
|
--keep ARTIFACT \
|
||||||
--keep MACOSX_DEPLOYMENT_TARGET --keep ac_cv_func_clock_gettime --keep HACKAGE_INDEX_STATE \
|
--keep OS \
|
||||||
--keep CABAL_DIR --keep ARCH --keep OS --keep CABAL_VERSION --keep GHC_VERSION \
|
--keep ARCH \
|
||||||
--keep JSON_VERSION --ARTIFACT \
|
--keep CABAL_DIR \
|
||||||
|
--keep GHC_VERSION \
|
||||||
|
--keep CABAL_VERSION \
|
||||||
--run "$1" 2>&1
|
--run "$1" 2>&1
|
||||||
}
|
}
|
||||||
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
|
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
|
||||||
@@ -219,6 +221,23 @@ test:linux:bootstrap_script:
|
|||||||
CABAL_VERSION: "3.4.0.0"
|
CABAL_VERSION: "3.4.0.0"
|
||||||
extends:
|
extends:
|
||||||
- .debian
|
- .debian
|
||||||
|
- .root_cleanup
|
||||||
|
needs: []
|
||||||
|
|
||||||
|
test:windows:bootstrap_powershell_script:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- ./bootstrap-haskell.ps1 -InstallDir $CI_PROJECT_DIR -BootstrapUrl $CI_PROJECT_DIR/bootstrap-haskell -InBash
|
||||||
|
after_script:
|
||||||
|
- "[Environment]::SetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', $null, [System.EnvironmentVariableTarget]::User)"
|
||||||
|
- "[Environment]::SetEnvironmentVariable('GHCUP_MSYS2', $null, [System.EnvironmentVariableTarget]::User)"
|
||||||
|
- "[Environment]::SetEnvironmentVariable('CABAL_DIR', $null, [System.EnvironmentVariableTarget]::User)"
|
||||||
|
- bash ./.gitlab/after_script.sh
|
||||||
|
variables:
|
||||||
|
GHC_VERSION: "8.10.5"
|
||||||
|
CABAL_VERSION: "3.4.0.0"
|
||||||
|
extends:
|
||||||
|
- .windows
|
||||||
needs: []
|
needs: []
|
||||||
|
|
||||||
######## linux test ########
|
######## linux test ########
|
||||||
@@ -355,7 +374,7 @@ release:linux:armv7:
|
|||||||
- .linux:armv7
|
- .linux:armv7
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "armv7-linux-ghcup"
|
ARTIFACT: "armv7-linux-ghcup"
|
||||||
GHC_VERSION: "8.10.4"
|
GHC_VERSION: "8.10.4"
|
||||||
@@ -368,7 +387,7 @@ release:linux:aarch64:
|
|||||||
- .linux:aarch64
|
- .linux:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "aarch64-linux-ghcup"
|
ARTIFACT: "aarch64-linux-ghcup"
|
||||||
GHC_VERSION: "8.10.4"
|
GHC_VERSION: "8.10.4"
|
||||||
@@ -398,8 +417,20 @@ release:darwin:aarch64:
|
|||||||
- .darwin:aarch64
|
- .darwin:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
before_script:
|
script: |
|
||||||
- ./.gitlab/before_script/darwin/install_deps.sh
|
set -Eeuo pipefail
|
||||||
|
function runInNixShell() {
|
||||||
|
time nix-shell .gitlab/shell.nix \
|
||||||
|
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
||||||
|
--argstr system "aarch64-darwin" \
|
||||||
|
--pure \
|
||||||
|
--keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \
|
||||||
|
--keep MACOSX_DEPLOYMENT_TARGET \
|
||||||
|
--keep JSON_VERSION --keep ARTIFACT \
|
||||||
|
--run "$1" 2>&1
|
||||||
|
}
|
||||||
|
runInNixShell ./.gitlab/before_script/darwin/install_deps.sh 2>&1
|
||||||
|
runInNixShell ./.gitlab/script/ghcup_release.sh 2>&1
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "aarch64-apple-darwin-ghcup"
|
ARTIFACT: "aarch64-apple-darwin-ghcup"
|
||||||
GHC_VERSION: "8.10.5"
|
GHC_VERSION: "8.10.5"
|
||||||
@@ -417,24 +448,8 @@ release:freebsd:
|
|||||||
- .freebsd
|
- .freebsd
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
script: |
|
before_script:
|
||||||
set -Eeuo pipefail
|
- ./.gitlab/before_script/freebsd/install_deps.sh
|
||||||
function runInNixShell() {
|
|
||||||
time nix-shell .gitlab/shell.nix \
|
|
||||||
-I nixpkgs=https://github.com/angerman/nixpkgs/archive/75f7281738b.tar.gz \
|
|
||||||
--argstr system "x86_64-darwin" \
|
|
||||||
--pure \
|
|
||||||
--keep GHC_VERSION --keep CABAL_INSTALL_VERSION --keep BUILD_FLAVOUR \
|
|
||||||
--keep BIN_DIST_PREP_TAR_COMP --keep CPUS --keep PROJECT_DIR \
|
|
||||||
--keep CI_PROJECT_DIR --keep MAKE_ARGS --keep HADRIAN_ARGS --keep CABAL_CACHE \
|
|
||||||
--keep LANG --keep CONFIGURE_ARGS --keep TEST_ENV --keep BIN_DIST_NAME \
|
|
||||||
--keep MACOSX_DEPLOYMENT_TARGET --keep ac_cv_func_clock_gettime --keep HACKAGE_INDEX_STATE \
|
|
||||||
--keep CABAL_DIR --keep ARCH --keep OS --keep CABAL_VERSION --keep GHC_VERSION \
|
|
||||||
--keep JSON_VERSION --ARTIFACT \
|
|
||||||
--run "$1" 2>&1
|
|
||||||
}
|
|
||||||
runInNixShell ./.gitlab/before_script/freebsd/install_deps.sh 2>&1
|
|
||||||
runInNixShell ./.gitlab/script/ghcup_release.sh 2>&1
|
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
||||||
GHC_VERSION: "8.10.5"
|
GHC_VERSION: "8.10.5"
|
||||||
|
|||||||
@@ -19,4 +19,14 @@ fi
|
|||||||
./ghcup-bin set ${GHC_VERSION}
|
./ghcup-bin set ${GHC_VERSION}
|
||||||
./ghcup-bin install-cabal ${CABAL_VERSION}
|
./ghcup-bin install-cabal ${CABAL_VERSION}
|
||||||
|
|
||||||
|
if [ $ARCH = 'ARM64' ] ; then
|
||||||
|
cabal update
|
||||||
|
mkdir vendored
|
||||||
|
cd vendored
|
||||||
|
cabal unpack network-3.1.2.1
|
||||||
|
cd network*
|
||||||
|
autoreconf -fi
|
||||||
|
cd ../..
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,13 +7,60 @@ set -eux
|
|||||||
mkdir -p "${TMPDIR}"
|
mkdir -p "${TMPDIR}"
|
||||||
|
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget
|
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https
|
||||||
|
|
||||||
curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ./ghcup-bin
|
case "${ARCH}" in
|
||||||
chmod +x ghcup-bin
|
ARM*)
|
||||||
|
case "${ARCH}" in
|
||||||
|
"ARM")
|
||||||
|
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-armv7-deb10-linux.tar.xz
|
||||||
|
cabal_url=home.smart-cactus.org/~ben/cabal-install-${CABAL_VERSION}-armv7-linux-bootstrapped.tar.xz
|
||||||
|
;;
|
||||||
|
"ARM64")
|
||||||
|
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz
|
||||||
|
cabal_url=https://downloads.haskell.org/~cabal/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}-aarch64-ubuntu-18.04.tar.xz
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
./ghcup-bin upgrade -i -f
|
mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin
|
||||||
./ghcup-bin install ${GHC_VERSION}
|
|
||||||
./ghcup-bin set ${GHC_VERSION}
|
curl -O "${ghc_url}"
|
||||||
./ghcup-bin install-cabal ${CABAL_VERSION}
|
tar -xf ghc-*.tar.*
|
||||||
|
cd ghc-${GHC_VERSION}
|
||||||
|
./configure --prefix="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}
|
||||||
|
make install
|
||||||
|
for i in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}/bin/*-${GHC_VERSION} ; do
|
||||||
|
ln -s "${i}" "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/${i##*/}
|
||||||
|
done
|
||||||
|
for x in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/*-${GHC_VERSION} ; do
|
||||||
|
ln -s ${x##*/} ${x%-${GHC_VERSION}}
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
rm -rf ghc-${GHC_VERSION} ghc-*.tar.*
|
||||||
|
unset x i
|
||||||
|
|
||||||
|
mkdir cabal-install
|
||||||
|
cd cabal-install
|
||||||
|
curl -O "${cabal_url}"
|
||||||
|
tar -xf cabal-install-*
|
||||||
|
mv cabal "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/cabal
|
||||||
|
cd ..
|
||||||
|
rm -rf cabal-install
|
||||||
|
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
url=https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
|
||||||
|
|
||||||
|
curl -sSfL "${url}" > ./ghcup-bin
|
||||||
|
chmod +x ghcup-bin
|
||||||
|
|
||||||
|
./ghcup-bin upgrade -i -f
|
||||||
|
./ghcup-bin install ${GHC_VERSION}
|
||||||
|
./ghcup-bin set ${GHC_VERSION}
|
||||||
|
./ghcup-bin install-cabal ${CABAL_VERSION}
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
|
|
||||||
|
|
||||||
mkdir -p "${TMPDIR}"
|
|
||||||
|
|
||||||
ednf() {
|
|
||||||
case "${ARCH}" in
|
|
||||||
"ARM")
|
|
||||||
sudo dnf -y --forcearch armv7hl "$@"
|
|
||||||
;;
|
|
||||||
"ARM64")
|
|
||||||
sudo dnf -y --forcearch aarch64 "$@"
|
|
||||||
;;
|
|
||||||
*) exit 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
ednf update
|
|
||||||
ednf install gcc gcc-c++ gmp gmp-devel make ncurses ncurses-devel xz xz-devel perl zlib zlib-devel openssl-devel openssl-libs openssl libffi libffi-devel lbzip2 lbzip2-utils bzip2-devel
|
|
||||||
if [ "${ARCH}" = "ARM64" ] ; then
|
|
||||||
ednf install numactl numactl-libs numactl-devel
|
|
||||||
fi
|
|
||||||
ednf install bash wget curl git tar
|
|
||||||
ednf install llvm9.0 llvm9.0-devel llvm9.0-libs llvm9.0-static
|
|
||||||
|
|
||||||
case "${ARCH}" in
|
|
||||||
"ARM")
|
|
||||||
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-armv7-deb10-linux.tar.xz
|
|
||||||
cabal_url=home.smart-cactus.org/~ben/cabal-install-${CABAL_VERSION}-armv7-linux-bootstrapped.tar.xz
|
|
||||||
;;
|
|
||||||
"ARM64")
|
|
||||||
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz
|
|
||||||
cabal_url=https://downloads.haskell.org/~cabal/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}-aarch64-ubuntu-18.04.tar.xz
|
|
||||||
;;
|
|
||||||
*) exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin
|
|
||||||
|
|
||||||
curl -O "${ghc_url}"
|
|
||||||
tar -xf ghc-*.tar.*
|
|
||||||
cd ghc-${GHC_VERSION}
|
|
||||||
./configure --prefix="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}
|
|
||||||
make install
|
|
||||||
for i in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}/bin/*-${GHC_VERSION} ; do
|
|
||||||
ln -s "${i}" "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/${i##*/}
|
|
||||||
done
|
|
||||||
for x in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/*-${GHC_VERSION} ; do
|
|
||||||
ln -s ${x##*/} ${x%-${GHC_VERSION}}
|
|
||||||
done
|
|
||||||
cd ..
|
|
||||||
rm -rf ghc-${GHC_VERSION} ghc-*.tar.*
|
|
||||||
unset x i
|
|
||||||
|
|
||||||
mkdir cabal-install
|
|
||||||
cd cabal-install
|
|
||||||
curl -O "${cabal_url}"
|
|
||||||
tar -xf cabal-install-*
|
|
||||||
mv cabal "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/cabal
|
|
||||||
cd ..
|
|
||||||
rm -rf cabal-install
|
|
||||||
@@ -4,6 +4,6 @@ if [ "${OS}" = "WINDOWS" ] ; then
|
|||||||
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
||||||
else
|
else
|
||||||
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
||||||
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:$PATH"
|
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:/opt/llvm/bin:$PATH"
|
||||||
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ ghcup-gen check -f ghcup-${JSON_VERSION}.yaml
|
|||||||
eghcup --numeric-version
|
eghcup --numeric-version
|
||||||
|
|
||||||
eghcup install ${GHC_VERSION}
|
eghcup install ${GHC_VERSION}
|
||||||
|
[ `$(eghcup whereis ghc ${GHC_VERSION}) --numeric-version` = "${GHC_VERSION}" ]
|
||||||
eghcup set ${GHC_VERSION}
|
eghcup set ${GHC_VERSION}
|
||||||
eghcup install-cabal ${CABAL_VERSION}
|
eghcup install-cabal ${CABAL_VERSION}
|
||||||
|
[ `$(eghcup whereis cabal ${CABAL_VERSION}) --numeric-version` = "${CABAL_VERSION}" ]
|
||||||
|
|
||||||
cabal --version
|
cabal --version
|
||||||
|
|
||||||
@@ -104,35 +106,39 @@ if [ "${OS}" != "WINDOWS" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# test installing new ghc doesn't mess with currently set GHC
|
if [ "${OS}" = "DARWIN" ] && [ "${ARCH}" = "ARM64" ] ; then
|
||||||
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
echo
|
||||||
if [ "${OS}" = "LINUX" ] ; then
|
else
|
||||||
eghcup --downloader=wget install 8.10.3
|
# test installing new ghc doesn't mess with currently set GHC
|
||||||
else # test wget a bit
|
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
|
||||||
eghcup install 8.10.3
|
if [ "${OS}" = "LINUX" ] ; then
|
||||||
fi
|
eghcup --downloader=wget install 8.10.3
|
||||||
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
else # test wget a bit
|
||||||
eghcup set 8.10.3
|
eghcup install 8.10.3
|
||||||
eghcup set 8.10.3
|
fi
|
||||||
[ "$(ghc --numeric-version)" = "8.10.3" ]
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
||||||
eghcup set ${GHC_VERSION}
|
eghcup set 8.10.3
|
||||||
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
eghcup set 8.10.3
|
||||||
eghcup rm 8.10.3
|
[ "$(ghc --numeric-version)" = "8.10.3" ]
|
||||||
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
eghcup set ${GHC_VERSION}
|
||||||
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
||||||
|
eghcup rm 8.10.3
|
||||||
|
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
|
||||||
|
|
||||||
if [ "${OS}" = "DARWIN" ] ; then
|
if [ "${OS}" = "DARWIN" ] ; then
|
||||||
eghcup install hls
|
|
||||||
haskell-language-server-wrapper --version
|
|
||||||
|
|
||||||
eghcup install stack
|
|
||||||
stack --version
|
|
||||||
elif [ "${OS}" = "LINUX" ] ; then
|
|
||||||
if [ "${ARCH}" = "64" ] ; then
|
|
||||||
eghcup install hls
|
eghcup install hls
|
||||||
haskell-language-server-wrapper --version
|
$(eghcup whereis hls) --version
|
||||||
|
|
||||||
eghcup install stack
|
eghcup install stack
|
||||||
stack --version
|
$(eghcup whereis stack) --version
|
||||||
|
elif [ "${OS}" = "LINUX" ] ; then
|
||||||
|
if [ "${ARCH}" = "64" ] ; then
|
||||||
|
eghcup install hls
|
||||||
|
haskell-language-server-wrapper --version
|
||||||
|
|
||||||
|
eghcup install stack
|
||||||
|
stack --version
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -150,3 +156,11 @@ fi
|
|||||||
eghcup upgrade
|
eghcup upgrade
|
||||||
eghcup upgrade -f
|
eghcup upgrade -f
|
||||||
|
|
||||||
|
|
||||||
|
# nuke
|
||||||
|
eghcup nuke
|
||||||
|
if [ "${OS}" = "WINDOWS" ] ; then
|
||||||
|
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/ghcup" ]
|
||||||
|
else
|
||||||
|
[ ! -e "${GHCUP_INSTALL_BASE_PREFIX}/.ghcup" ]
|
||||||
|
fi
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
# unconditionally add the MacOSX.sdk and TargetConditional.h
|
# unconditionally add the MacOSX.sdk and TargetConditional.h
|
||||||
export NIX_CFLAGS_COMPILE+=" -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
export NIX_CFLAGS_COMPILE+=" -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||||
|
|
||||||
# Use an architecture specific home, so cabal for different architectures don't confuse each other.
|
|
||||||
export HOME="$HOME/$(uname -m)-home"
|
|
||||||
mkdir -p $HOME
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = (with pkgs; [
|
nativeBuildInputs = (with pkgs; [
|
||||||
@@ -81,6 +78,7 @@
|
|||||||
|
|
||||||
which
|
which
|
||||||
wget
|
wget
|
||||||
|
curl
|
||||||
file
|
file
|
||||||
|
|
||||||
xz
|
xz
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# Revision history for ghcup
|
# Revision history for ghcup
|
||||||
|
|
||||||
|
## 0.1.16 -- ????-??-??
|
||||||
|
|
||||||
|
* Add 'nuke' subcommand wrt [#135](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/135), implemented by Arjun Kathuria
|
||||||
|
|
||||||
## 0.1.15.2 -- 2021-06-13
|
## 0.1.15.2 -- 2021-06-13
|
||||||
|
|
||||||
* Remove legacy handling of cabal binary and be more graceful about binaries not installed by ghcup (e.g. stack)
|
* Remove legacy handling of cabal binary and be more graceful about binaries not installed by ghcup (e.g. stack)
|
||||||
|
|||||||
@@ -69,3 +69,7 @@ yaml files: `ghcup-<yaml-ver>.yaml`.
|
|||||||
Most of the `Version` parameters to functions had to be replaced with
|
Most of the `Version` parameters to functions had to be replaced with
|
||||||
that and ensured the logic is consistent for cross and non-cross
|
that and ensured the logic is consistent for cross and non-cross
|
||||||
installs.
|
installs.
|
||||||
|
2. This refactor added windows support wrt [#130](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/130).
|
||||||
|
The major changes here were switching `hpath` library out for `filepath`/`directory` (sadly) and
|
||||||
|
introducing a non-unix way of handling processes via the `process` library. It also introduced considerable
|
||||||
|
amounts of CPP wrt file handling, installation etc.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
`ghcup` makes it easy to install specific versions of `ghc` on GNU/Linux,
|
`ghcup` makes it easy to install specific versions of `ghc` on GNU/Linux,
|
||||||
macOS (aka Darwin) and FreeBSD and can also bootstrap a fresh Haskell developer environment from scratch.
|
macOS (aka Darwin), FreeBSD and Windows and can also bootstrap a fresh Haskell developer environment from scratch.
|
||||||
It follows the unix UNIX philosophy of [do one thing and do it well](https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well).
|
It follows the unix UNIX philosophy of [do one thing and do it well](https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well).
|
||||||
|
|
||||||
Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [pyenv](https://github.com/pyenv/pyenv) and [jenv](http://www.jenv.be).
|
Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [pyenv](https://github.com/pyenv/pyenv) and [jenv](http://www.jenv.be).
|
||||||
@@ -85,7 +85,7 @@ handles your haskell packages and can demand that [a specific version](https://c
|
|||||||
A configuration file can be put in `~/.ghcup/config.yaml`. The default config file
|
A configuration file can be put in `~/.ghcup/config.yaml`. The default config file
|
||||||
explaining all possible configurations can be found in this repo: [config.yaml](./config.yaml).
|
explaining all possible configurations can be found in this repo: [config.yaml](./config.yaml).
|
||||||
|
|
||||||
Partial configuration is fine. Command line options always overwrite the config file settings.
|
Partial configuration is fine. Command line options always override the config file settings.
|
||||||
|
|
||||||
### Manpages
|
### Manpages
|
||||||
|
|
||||||
|
|||||||
@@ -100,9 +100,11 @@ data Command
|
|||||||
| Rm (Either RmCommand RmOptions)
|
| Rm (Either RmCommand RmOptions)
|
||||||
| DInfo
|
| DInfo
|
||||||
| Compile CompileCommand
|
| Compile CompileCommand
|
||||||
|
| Whereis WhereisOptions WhereisCommand
|
||||||
| Upgrade UpgradeOpts Bool
|
| Upgrade UpgradeOpts Bool
|
||||||
| ToolRequirements
|
| ToolRequirements
|
||||||
| ChangeLog ChangeLogOptions
|
| ChangeLog ChangeLogOptions
|
||||||
|
| Nuke
|
||||||
#if defined(BRICK)
|
#if defined(BRICK)
|
||||||
| Interactive
|
| Interactive
|
||||||
#endif
|
#endif
|
||||||
@@ -189,6 +191,13 @@ data ChangeLogOptions = ChangeLogOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
||||||
|
|
||||||
|
data WhereisOptions = WhereisOptions {
|
||||||
|
directory :: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- https://github.com/pcapriotti/optparse-applicative/issues/148
|
-- https://github.com/pcapriotti/optparse-applicative/issues/148
|
||||||
|
|
||||||
-- | A switch that can be enabled using --foo and disabled using --no-foo.
|
-- | A switch that can be enabled using --foo and disabled using --no-foo.
|
||||||
@@ -219,7 +228,7 @@ invertableSwitch'
|
|||||||
-> Mod FlagFields Bool -- ^ option modifier for --no-foo
|
-> Mod FlagFields Bool -- ^ option modifier for --no-foo
|
||||||
-> Parser (Maybe Bool)
|
-> Parser (Maybe Bool)
|
||||||
invertableSwitch' longopt shortopt defv enmod dismod = optional
|
invertableSwitch' longopt shortopt defv enmod dismod = optional
|
||||||
( flag' True (enmod <> long longopt <> if defv then mempty else short shortopt)
|
( flag' True ( enmod <> long longopt <> if defv then mempty else short shortopt)
|
||||||
<|> flag' False (dismod <> long nolongopt <> if defv then short shortopt else mempty)
|
<|> flag' False (dismod <> long nolongopt <> if defv then short shortopt else mempty)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
@@ -334,6 +343,17 @@ com =
|
|||||||
<$> info (compileP <**> helper)
|
<$> info (compileP <**> helper)
|
||||||
(progDesc "Compile a tool from source")
|
(progDesc "Compile a tool from source")
|
||||||
)
|
)
|
||||||
|
<> command
|
||||||
|
"whereis"
|
||||||
|
(info
|
||||||
|
( (Whereis
|
||||||
|
<$> (WhereisOptions <$> switch (short 'd' <> long "directory" <> help "return directory of the binary instead of the binary location"))
|
||||||
|
<*> whereisP
|
||||||
|
) <**> helper
|
||||||
|
)
|
||||||
|
(progDesc "Find a tools location"
|
||||||
|
<> footerDoc ( Just $ text whereisFooter ))
|
||||||
|
)
|
||||||
<> commandGroup "Main commands:"
|
<> commandGroup "Main commands:"
|
||||||
)
|
)
|
||||||
<|> subparser
|
<|> subparser
|
||||||
@@ -368,6 +388,14 @@ com =
|
|||||||
)
|
)
|
||||||
<> internal
|
<> internal
|
||||||
)
|
)
|
||||||
|
<|> subparser
|
||||||
|
(command
|
||||||
|
"nuke"
|
||||||
|
(info (pure Nuke <**> helper)
|
||||||
|
(progDesc "Completely remove ghcup from your system"))
|
||||||
|
<> commandGroup "Nuclear Commands:"
|
||||||
|
)
|
||||||
|
|
||||||
where
|
where
|
||||||
installToolFooter :: String
|
installToolFooter :: String
|
||||||
installToolFooter = [s|Discussion:
|
installToolFooter = [s|Discussion:
|
||||||
@@ -393,6 +421,22 @@ com =
|
|||||||
By default returns the URI of the ChangeLog of the latest GHC release.
|
By default returns the URI of the ChangeLog of the latest GHC release.
|
||||||
Pass '-o' to automatically open via xdg-open.|]
|
Pass '-o' to automatically open via xdg-open.|]
|
||||||
|
|
||||||
|
whereisFooter :: String
|
||||||
|
whereisFooter = [s|Discussion:
|
||||||
|
Finds the location of a tool. For GHC, this is the ghc binary, that
|
||||||
|
usually resides in a self-contained "~/.ghcup/ghc/<ghcver>" directory.
|
||||||
|
For cabal/stack/hls this the binary usually at "~/.ghcup/bin/<tool>-<ver>".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/ghc.exe
|
||||||
|
ghcup whereis ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/
|
||||||
|
ghcup whereis --directory ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/bin/cabal-3.4.0.0
|
||||||
|
ghcup whereis cabal 3.4.0.0
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory cabal 3.4.0.0|]
|
||||||
|
|
||||||
|
|
||||||
installCabalFooter :: String
|
installCabalFooter :: String
|
||||||
installCabalFooter = [s|Discussion:
|
installCabalFooter = [s|Discussion:
|
||||||
@@ -698,6 +742,86 @@ Examples:
|
|||||||
ghcup compile ghc -j 4 -v 8.4.2 -b 8.2.2 -x armv7-unknown-linux-gnueabihf --config $(pwd)/build.mk -- --enable-unregisterised|]
|
ghcup compile ghc -j 4 -v 8.4.2 -b 8.2.2 -x armv7-unknown-linux-gnueabihf --config $(pwd)/build.mk -- --enable-unregisterised|]
|
||||||
|
|
||||||
|
|
||||||
|
whereisP :: Parser WhereisCommand
|
||||||
|
whereisP = subparser
|
||||||
|
( command
|
||||||
|
"ghc"
|
||||||
|
(WhereisTool GHC <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
||||||
|
( progDesc "Get GHC location"
|
||||||
|
<> footerDoc (Just $ text whereisGHCFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"cabal"
|
||||||
|
(WhereisTool Cabal <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just Cabal)) <**> helper )
|
||||||
|
( progDesc "Get cabal location"
|
||||||
|
<> footerDoc (Just $ text whereisCabalFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"hls"
|
||||||
|
(WhereisTool HLS <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just HLS)) <**> helper )
|
||||||
|
( progDesc "Get HLS location"
|
||||||
|
<> footerDoc (Just $ text whereisHLSFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"stack"
|
||||||
|
(WhereisTool Stack <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just Stack)) <**> helper )
|
||||||
|
( progDesc "Get stack location"
|
||||||
|
<> footerDoc (Just $ text whereisStackFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"ghcup"
|
||||||
|
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
||||||
|
)
|
||||||
|
where
|
||||||
|
whereisGHCFooter = [s|Discussion:
|
||||||
|
Finds the location of a GHC executable, which usually resides in
|
||||||
|
a self-contained "~/.ghcup/ghc/<ghcver>" directory.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/ghc.exe
|
||||||
|
ghcup whereis ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/
|
||||||
|
ghcup whereis --directory ghc 8.10.5 |]
|
||||||
|
|
||||||
|
whereisCabalFooter = [s|Discussion:
|
||||||
|
Finds the location of a Cabal executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/cabal-3.4.0.0
|
||||||
|
ghcup whereis cabal 3.4.0.0
|
||||||
|
# outputs ~/.ghcup/bin
|
||||||
|
ghcup whereis --directory cabal 3.4.0.0|]
|
||||||
|
|
||||||
|
whereisHLSFooter = [s|Discussion:
|
||||||
|
Finds the location of a HLS executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/haskell-language-server-wrapper-1.2.0
|
||||||
|
ghcup whereis hls 1.2.0
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory hls 1.2.0|]
|
||||||
|
|
||||||
|
whereisStackFooter = [s|Discussion:
|
||||||
|
Finds the location of a stack executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/stack-2.7.1
|
||||||
|
ghcup whereis stack 2.7.1
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory stack 2.7.1|]
|
||||||
|
|
||||||
|
|
||||||
ghcCompileOpts :: Parser GHCCompileOptions
|
ghcCompileOpts :: Parser GHCCompileOptions
|
||||||
ghcCompileOpts =
|
ghcCompileOpts =
|
||||||
GHCCompileOptions
|
GHCCompileOptions
|
||||||
@@ -1105,7 +1229,10 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
let loggerConfig = LoggerConfig
|
let loggerConfig = LoggerConfig
|
||||||
{ lcPrintDebug = verbose settings
|
{ lcPrintDebug = verbose settings
|
||||||
, colorOutter = B.hPut stderr
|
, colorOutter = B.hPut stderr
|
||||||
, rawOutter = B.appendFile logfile
|
, rawOutter =
|
||||||
|
case optCommand of
|
||||||
|
Nuke -> \_ -> pure ()
|
||||||
|
_ -> B.appendFile logfile
|
||||||
}
|
}
|
||||||
let runLogger = myLoggerT loggerConfig
|
let runLogger = myLoggerT loggerConfig
|
||||||
let siletRunLogger = myLoggerT loggerConfig { colorOutter = \_ -> pure () }
|
let siletRunLogger = myLoggerT loggerConfig { colorOutter = \_ -> pure () }
|
||||||
@@ -1254,6 +1381,17 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
#endif
|
#endif
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let
|
||||||
|
runWhereIs =
|
||||||
|
runLogger
|
||||||
|
. flip runReaderT appstate
|
||||||
|
. runE
|
||||||
|
@'[ NotInstalled
|
||||||
|
, NoToolVersionSet
|
||||||
|
, NextVerNotFound
|
||||||
|
, TagNotFound
|
||||||
|
]
|
||||||
|
|
||||||
let runUpgrade =
|
let runUpgrade =
|
||||||
runLogger
|
runLogger
|
||||||
. flip runReaderT appstate
|
. flip runReaderT appstate
|
||||||
@@ -1617,6 +1755,22 @@ Make sure to clean up #{tmpdir} afterwards.|])
|
|||||||
runLogger $ $(logError) $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 9
|
pure $ ExitFailure 9
|
||||||
|
|
||||||
|
Whereis WhereisOptions{..} (WhereisTool tool whereVer) ->
|
||||||
|
runWhereIs (do
|
||||||
|
(v, _) <- liftE $ fromVersion whereVer tool
|
||||||
|
loc <- liftE $ whereIsTool tool v
|
||||||
|
if directory
|
||||||
|
then pure $ takeDirectory loc
|
||||||
|
else pure loc
|
||||||
|
)
|
||||||
|
>>= \case
|
||||||
|
VRight r -> do
|
||||||
|
putStr r
|
||||||
|
pure ExitSuccess
|
||||||
|
VLeft e -> do
|
||||||
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
Upgrade uOpts force -> do
|
Upgrade uOpts force -> do
|
||||||
target <- case uOpts of
|
target <- case uOpts of
|
||||||
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
||||||
@@ -1693,9 +1847,41 @@ Make sure to clean up #{tmpdir} afterwards.|])
|
|||||||
>> pure (ExitFailure 13)
|
>> pure (ExitFailure 13)
|
||||||
else putStrLn uri' >> pure ExitSuccess
|
else putStrLn uri' >> pure ExitSuccess
|
||||||
|
|
||||||
|
Nuke ->
|
||||||
|
runRm (do
|
||||||
|
lift $ $logWarn "WARNING: This will remove GHCup and all installed components from your system."
|
||||||
|
lift $ $logWarn "Waiting 10 seconds before commencing, if you want to cancel it, now would be the time."
|
||||||
|
liftIO $ threadDelay 10000000 -- wait 10s
|
||||||
|
|
||||||
|
lift $ $logInfo "Initiating Nuclear Sequence 🚀🚀🚀"
|
||||||
|
lift $ $logInfo "Nuking in 3...2...1"
|
||||||
|
|
||||||
|
lInstalled <- lift $ listVersions Nothing (Just ListInstalled)
|
||||||
|
|
||||||
|
forM_ lInstalled (liftE . rmTool)
|
||||||
|
|
||||||
|
lift rmGhcupDirs
|
||||||
|
|
||||||
|
) >>= \case
|
||||||
|
VRight leftOverFiles
|
||||||
|
| null leftOverFiles -> do
|
||||||
|
runLogger $ $logInfo "Nuclear Annihilation complete!"
|
||||||
|
pure ExitSuccess
|
||||||
|
| otherwise -> do
|
||||||
|
runLogger $ $logWarn "These Files have survived Nuclear Annihilation, you may remove them manually."
|
||||||
|
forM_ leftOverFiles putStrLn
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
VLeft e -> do
|
||||||
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
|
pure $ ExitFailure 15
|
||||||
|
|
||||||
|
|
||||||
case res of
|
case res of
|
||||||
ExitSuccess -> pure ()
|
ExitSuccess -> pure ()
|
||||||
ef@(ExitFailure _) -> exitWith ef
|
ef@(ExitFailure _) -> exitWith ef
|
||||||
|
|
||||||
|
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
fromVersion :: (MonadLogger m, MonadFail m, MonadReader AppState m, MonadThrow m, MonadIO m, MonadCatch m)
|
fromVersion :: (MonadLogger m, MonadFail m, MonadReader AppState m, MonadThrow m, MonadIO m, MonadCatch m)
|
||||||
|
|||||||
@@ -5,8 +5,12 @@
|
|||||||
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
|
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
|
||||||
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
|
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
|
||||||
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
|
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
|
||||||
# * BOOTSTRAP_HASKELL_GHC_VERSION
|
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
|
||||||
# * BOOTSTRAP_HASKELL_CABAL_VERSION
|
# * BOOTSTRAP_HASKELL_CABAL_VERSION - the cabal version to install
|
||||||
|
# * BOOTSTRAP_HASKELL_INSTALL_STACK - whether to install latest stack
|
||||||
|
# * BOOTSTRAP_HASKELL_INSTALL_HLS - whether to install latest hls
|
||||||
|
# * BOOTSTRAP_HASKELL_ADJUST_BASHRC - whether to adjust PATH in bashrc (prepend)
|
||||||
|
# * BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG - whether to adjust mingw paths in cabal.config on windows
|
||||||
|
|
||||||
# License: LGPL-3.0
|
# License: LGPL-3.0
|
||||||
|
|
||||||
@@ -16,9 +20,11 @@
|
|||||||
|
|
||||||
plat="$(uname -s)"
|
plat="$(uname -s)"
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
ghver="0.1.15.1"
|
ghver="0.1.15.2"
|
||||||
base_url="https://downloads.haskell.org/~ghcup"
|
base_url="https://downloads.haskell.org/~ghcup"
|
||||||
|
|
||||||
|
export GHCUP_SKIP_UPDATE_CHECK=yes
|
||||||
|
|
||||||
case "${plat}" in
|
case "${plat}" in
|
||||||
MSYS*|MINGW*)
|
MSYS*|MINGW*)
|
||||||
: "${GHCUP_INSTALL_BASE_PREFIX:=/c}"
|
: "${GHCUP_INSTALL_BASE_PREFIX:=/c}"
|
||||||
@@ -60,6 +66,28 @@ warn() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yellow() {
|
||||||
|
case "${plat}" in
|
||||||
|
MSYS*|MINGW*)
|
||||||
|
echo -e "\\033[0;33m$1\\033[0m"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "\\033[0;33m%s\\033[0m\\n" "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
green() {
|
||||||
|
case "${plat}" in
|
||||||
|
MSYS*|MINGW*)
|
||||||
|
echo -e "\\033[0;32m$1\\033[0m"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "\\033[0;32m%s\\033[0m\\n" "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
edo() {
|
edo() {
|
||||||
"$@" || die "\"$*\" failed!"
|
"$@" || die "\"$*\" failed!"
|
||||||
}
|
}
|
||||||
@@ -80,40 +108,42 @@ _eghcup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_done() {
|
_done() {
|
||||||
|
echo
|
||||||
|
echo "==============================================================================="
|
||||||
case "${plat}" in
|
case "${plat}" in
|
||||||
MSYS*|MINGW*)
|
MSYS*|MINGW*)
|
||||||
echo
|
green
|
||||||
echo "All done!"
|
green "All done!"
|
||||||
echo
|
green
|
||||||
echo "In a new powershell or cmd.exe session, now you can..."
|
green "In a new powershell or cmd.exe session, now you can..."
|
||||||
echo
|
green
|
||||||
echo "Start a simple repl via:"
|
green "Start a simple repl via:"
|
||||||
echo " ghci"
|
green " ghci"
|
||||||
echo
|
green
|
||||||
echo "Start a new haskell project in the current directory via:"
|
green "Start a new haskell project in the current directory via:"
|
||||||
echo " cabal init --interactive"
|
green " cabal init --interactive"
|
||||||
echo
|
green
|
||||||
echo "Install other GHC versions and tools via:"
|
green "Install other GHC versions and tools via:"
|
||||||
echo " ghcup list"
|
green " ghcup list"
|
||||||
echo " ghcup install <tool> <version>"
|
green " ghcup install <tool> <version>"
|
||||||
echo
|
green
|
||||||
echo "To install system libraries and update msys2/mingw64,"
|
green "To install system libraries and update msys2/mingw64,"
|
||||||
echo "open the \"Mingw haskell shell\""
|
green "open the \"Mingw haskell shell\""
|
||||||
echo "and the \"Mingw package management docs\""
|
green "and the \"Mingw package management docs\""
|
||||||
echo "desktop shortcuts."
|
green "desktop shortcuts."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo
|
green
|
||||||
echo "All done!"
|
green "All done!"
|
||||||
echo
|
green
|
||||||
echo "To start a simple repl, run:"
|
green "To start a simple repl, run:"
|
||||||
echo " ghci"
|
green " ghci"
|
||||||
echo
|
green
|
||||||
echo "To start a new haskell project in the current directory, run:"
|
green "To start a new haskell project in the current directory, run:"
|
||||||
echo " cabal init --interactive"
|
green " cabal init --interactive"
|
||||||
echo
|
green
|
||||||
echo "To install other GHC versions and tools, run:"
|
green "To install other GHC versions and tools, run:"
|
||||||
echo " ghcup tui"
|
green " ghcup tui"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
@@ -201,15 +231,297 @@ download_ghcup() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
edo mkdir -p "${GHCUP_DIR}"
|
edo mkdir -p "${GHCUP_DIR}"
|
||||||
|
|
||||||
|
# we may overwrite this in adjust_bashrc
|
||||||
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
edo . "${GHCUP_DIR}"/env
|
edo . "${GHCUP_DIR}"/env
|
||||||
eghcup upgrade
|
eghcup upgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Figures out the users login shell and sets
|
||||||
|
# GHCUP_PROFILE_FILE and MY_SHELL variables.
|
||||||
|
find_shell() {
|
||||||
|
case $SHELL in
|
||||||
|
*/zsh) # login shell is zsh
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.zshrc"
|
||||||
|
MY_SHELL="zsh" ;;
|
||||||
|
*/bash) # login shell is bash
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
||||||
|
MY_SHELL="bash" ;;
|
||||||
|
*/sh) # login shell is sh, but might be a symlink to bash or zsh
|
||||||
|
if [ -n "${BASH}" ] ; then
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
||||||
|
MY_SHELL="bash"
|
||||||
|
elif [ -n "${ZSH_VERSION}" ] ; then
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.zshrc"
|
||||||
|
MY_SHELL="zsh"
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*/fish) # login shell is fish
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.config/fish/config.fish"
|
||||||
|
MY_SHELL="fish" ;;
|
||||||
|
*) return ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ask user if they want to adjust the bashrc.
|
||||||
|
ask_bashrc() {
|
||||||
|
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_BASHRC}" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
warn ""
|
||||||
|
warn "Detected ${MY_SHELL} shell on your system..."
|
||||||
|
warn "Do you want ghcup to automatically add the required PATH variable to \"${GHCUP_PROFILE_FILE}\"?"
|
||||||
|
warn ""
|
||||||
|
warn "[P] Yes, prepend [A] Yes, append [N] No [?] Help (default is \"P\")."
|
||||||
|
warn ""
|
||||||
|
|
||||||
|
read -r bashrc_answer </dev/tty
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
case $bashrc_answer in
|
||||||
|
[Pp]* | "")
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
[Aa]*)
|
||||||
|
return 2
|
||||||
|
;;
|
||||||
|
[Nn]*)
|
||||||
|
return 0;;
|
||||||
|
*)
|
||||||
|
echo "Possible choices are:"
|
||||||
|
echo
|
||||||
|
echo "P - Yes, prepend to PATH, taking precedence (default)"
|
||||||
|
echo "A - Yes, append to PATH"
|
||||||
|
echo "N - No, don't mess with my configuration"
|
||||||
|
echo
|
||||||
|
echo "Please make your choice and press ENTER."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
unset bashrc_answer
|
||||||
|
}
|
||||||
|
|
||||||
|
# Needs 'find_shell' to be called beforehand.
|
||||||
|
adjust_bashrc() {
|
||||||
|
case $1 in
|
||||||
|
1)
|
||||||
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
|
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
|
export PATH="\$HOME/.cabal/bin:\$PATH:${GHCUP_BIN}"
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
1 | 2)
|
||||||
|
case $MY_SHELL in
|
||||||
|
"") break ;;
|
||||||
|
fish)
|
||||||
|
mkdir -p "${GHCUP_PROFILE_FILE%/*}"
|
||||||
|
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
||||||
|
case $1 in
|
||||||
|
1)
|
||||||
|
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; set -gx PATH \$HOME/.cabal/bin $GHCUP_BIN \$PATH # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; set -gx PATH \$HOME/.cabal/bin \$PATH $GHCUP_BIN # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
break ;;
|
||||||
|
bash)
|
||||||
|
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
||||||
|
echo "[ -f \"${GHCUP_DIR}/env\" ] && source \"${GHCUP_DIR}/env\" # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
case "${plat}" in
|
||||||
|
"Darwin"|"darwin")
|
||||||
|
if ! grep -q "ghcup-env" "${HOME}/.bash_profile" ; then
|
||||||
|
echo "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
break ;;
|
||||||
|
|
||||||
|
zsh)
|
||||||
|
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
||||||
|
echo "[ -f \"${GHCUP_DIR}/env\" ] && source \"${GHCUP_DIR}/env\" # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
break ;;
|
||||||
|
esac
|
||||||
|
warn "OK! ${GHCUP_PROFILE_FILE} has been modified. Restart your terminal for the changes to take effect,"
|
||||||
|
warn "or type \"source ${GHCUP_DIR}/env\" to apply them in your current terminal session."
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
adjust_cabal_config() {
|
||||||
|
edo cabal user-config -a "extra-prog-path: $(cygpath -w "$GHCUP_BIN"), $(cygpath -w "$HOME"/AppData/Roaming/cabal/bin), $(cygpath -w "$GHCUP_MSYS2"/usr/bin), $(cygpath -w "$GHCUP_MSYS2"/mingw64/bin)" -a "extra-include-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/include)" -a "extra-lib-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/lib)" -f init
|
||||||
|
}
|
||||||
|
|
||||||
|
ask_cabal_config_init() {
|
||||||
|
case "${plat}" in
|
||||||
|
MSYS*|MINGW*)
|
||||||
|
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG}" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
warn "Create an initial cabal.config including relevant msys2 paths (recommended)?"
|
||||||
|
warn "[Y] Yes [N] No [?] Help (default is \"Y\")."
|
||||||
|
echo
|
||||||
|
while true; do
|
||||||
|
read -r mingw_answer </dev/tty
|
||||||
|
|
||||||
|
case $mingw_answer in
|
||||||
|
[Yy]* | "")
|
||||||
|
return 1 ;;
|
||||||
|
[Nn]*)
|
||||||
|
return 0 ;;
|
||||||
|
*)
|
||||||
|
echo "Possible choices are:"
|
||||||
|
echo
|
||||||
|
echo "Y - Yes, create a cabal.config with pre-set paths to msys2/mingw64 (default)"
|
||||||
|
echo "N - No, leave the current/default cabal config untouched"
|
||||||
|
echo
|
||||||
|
echo "Please make your choice and press ENTER."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
unset mingw_answer
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
do_cabal_config_init() {
|
||||||
|
case "${plat}" in
|
||||||
|
MSYS*|MINGW*)
|
||||||
|
case $1 in
|
||||||
|
1)
|
||||||
|
adjust_cabal_config
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
echo "Make sure that your global cabal.config references the correct mingw64 paths (extra-prog-path, extra-include-dirs and extra-lib-dirs)."
|
||||||
|
echo "And set the environment variable GHCUP_MSYS2 to the root path of your msys2 installation."
|
||||||
|
sleep 5
|
||||||
|
return ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ask_hls() {
|
||||||
|
if [ -n "${BOOTSTRAP_HASKELL_INSTALL_HLS}" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
warn "Do you want to install haskell-language-server (HLS)?"
|
||||||
|
warn "HLS is a language-server that provides IDE-like functionality"
|
||||||
|
warn "and can integrate with different editors, such as Vim, Emacs, VS Code, Atom, ..."
|
||||||
|
warn "Also see https://github.com/haskell/haskell-language-server/blob/master/README.md"
|
||||||
|
warn ""
|
||||||
|
warn "[Y] Yes [N] No [?] Help (default is \"N\")."
|
||||||
|
warn ""
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -r hls_answer </dev/tty
|
||||||
|
|
||||||
|
case $hls_answer in
|
||||||
|
[Yy]*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
[Nn]* | "")
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Possible choices are:"
|
||||||
|
echo
|
||||||
|
echo "Y - Yes, install the haskell-langauge-server"
|
||||||
|
echo "N - No, don't install anything more (default)"
|
||||||
|
echo
|
||||||
|
echo "Please make your choice and press ENTER."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset hls_answer
|
||||||
|
}
|
||||||
|
|
||||||
|
ask_stack() {
|
||||||
|
if [ -n "${BOOTSTRAP_HASKELL_INSTALL_STACK}" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
warn "Do you want to install stack?"
|
||||||
|
warn "Stack is a haskell build tool similar to cabal that is used by some projects."
|
||||||
|
warn "Also see https://docs.haskellstack.org/"
|
||||||
|
warn ""
|
||||||
|
warn "[Y] Yes [N] No [?] Help (default is \"N\")."
|
||||||
|
warn ""
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -r stack_answer </dev/tty
|
||||||
|
|
||||||
|
case $stack_answer in
|
||||||
|
[Yy]*)
|
||||||
|
return 1 ;;
|
||||||
|
[Nn]* | "")
|
||||||
|
return 0 ;;
|
||||||
|
*)
|
||||||
|
echo "Possible choices are:"
|
||||||
|
echo
|
||||||
|
echo "Y - Yes, install stack"
|
||||||
|
echo "N - No, don't install anything more (default)"
|
||||||
|
echo
|
||||||
|
echo "Please make your choice and press ENTER."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset stack_answer
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
find_shell
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Welcome to Haskell!"
|
echo "Welcome to Haskell!"
|
||||||
@@ -241,12 +553,20 @@ echo
|
|||||||
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
warn "Press ENTER to proceed or ctrl-c to abort."
|
warn "Press ENTER to proceed or ctrl-c to abort."
|
||||||
warn "Note that this script can be re-run at any given time."
|
warn "Note that this script can be re-run at any given time."
|
||||||
echo
|
|
||||||
# Wait for user input to continue.
|
# Wait for user input to continue.
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
read -r answer </dev/tty
|
read -r answer </dev/tty
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ask_bashrc
|
||||||
|
ask_bashrc_answer=$?
|
||||||
|
ask_cabal_config_init
|
||||||
|
ask_cabal_config_init_answer=$?
|
||||||
|
ask_hls
|
||||||
|
ask_hls_answer=$?
|
||||||
|
ask_stack
|
||||||
|
ask_stack_answer=$?
|
||||||
|
|
||||||
edo mkdir -p "${GHCUP_BIN}"
|
edo mkdir -p "${GHCUP_BIN}"
|
||||||
|
|
||||||
if command -V "ghcup" >/dev/null 2>&1 ; then
|
if command -V "ghcup" >/dev/null 2>&1 ; then
|
||||||
@@ -276,185 +596,55 @@ eghcup --cache install ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
|||||||
eghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
eghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
||||||
eghcup --cache install cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
eghcup --cache install cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
||||||
|
|
||||||
adjust_cabal_config() {
|
do_cabal_config_init $ask_cabal_config_init_answer
|
||||||
edo cabal user-config -a "extra-prog-path: $(cygpath -w "$GHCUP_BIN"), $(cygpath -w "$HOME"/AppData/Roaming/cabal/bin), $(cygpath -w "$GHCUP_MSYS2"/usr/bin), $(cygpath -w "$GHCUP_MSYS2"/mingw64/bin)" -a "extra-include-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/include)" -a "extra-lib-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/lib)" -f init
|
|
||||||
}
|
|
||||||
|
|
||||||
case "${plat}" in
|
|
||||||
MSYS*|MINGW*)
|
|
||||||
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
|
||||||
warn "Create an initial cabal.config including relevant msys2 paths (recommended)?"
|
|
||||||
warn "[Y] Yes [N] No [?] Help (default is \"Y\")."
|
|
||||||
echo
|
|
||||||
while true; do
|
|
||||||
read -r mingw_answer </dev/tty
|
|
||||||
|
|
||||||
case $mingw_answer in
|
|
||||||
[Yy]* | "")
|
|
||||||
adjust_cabal_config
|
|
||||||
break ;;
|
|
||||||
[Nn]*)
|
|
||||||
echo "Make sure that your global cabal.config references the correct mingw64 paths (extra-prog-path, extra-include-dirs and extra-lib-dirs)."
|
|
||||||
echo "And set the environment variable GHCUP_MSYS2 to the root path of your msys2 installation."
|
|
||||||
sleep 5
|
|
||||||
break ;;
|
|
||||||
*)
|
|
||||||
echo "Possible choices are:"
|
|
||||||
echo
|
|
||||||
echo "Y - Yes, create a cabal.config with pre-set paths to msys2/mingw64 (default)"
|
|
||||||
echo "N - No, leave the current/default cabal config untouched"
|
|
||||||
echo
|
|
||||||
echo "Please make your choice and press ENTER."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
|
||||||
adjust_cabal_config
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
edo cabal new-update
|
edo cabal new-update
|
||||||
|
|
||||||
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
case $ask_hls_answer in
|
||||||
warn "Do you want to install haskell-language-server (HLS) now?"
|
1)
|
||||||
warn "HLS is a language-server that provides IDE-like functionality"
|
_eghcup --cache install hls || warn "HLS installation failed, continuing anyway"
|
||||||
warn "and can integrate with different editors, such as Vim, Emacs, VS Code, Atom, ..."
|
;;
|
||||||
warn "Also see https://github.com/haskell/haskell-language-server/blob/master/README.md"
|
*) ;;
|
||||||
warn ""
|
esac
|
||||||
warn "[Y] Yes [N] No [?] Help (default is \"N\")."
|
|
||||||
warn ""
|
|
||||||
|
|
||||||
while true; do
|
case $ask_stack_answer in
|
||||||
read -r hls_answer </dev/tty
|
1)
|
||||||
|
_eghcup --cache install stack || warn "Stack installation failed, continuing anyway"
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case $hls_answer in
|
|
||||||
[Yy]*)
|
|
||||||
eghcup --cache install hls || warn "HLS installation failed, continuing anyway"
|
|
||||||
break ;;
|
|
||||||
[Nn]* | "")
|
|
||||||
break ;;
|
|
||||||
*)
|
|
||||||
echo "Possible choices are:"
|
|
||||||
echo
|
|
||||||
echo "Y - Yes, install the haskell-langauge-server"
|
|
||||||
echo "N - No, don't install anything more (default)"
|
|
||||||
echo
|
|
||||||
echo "Please make your choice and press ENTER."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
warn "Do you want to install stack now?"
|
|
||||||
warn "Stack is a haskell build tool similar to cabal that is used by some projects."
|
|
||||||
warn "Also see https://docs.haskellstack.org/"
|
|
||||||
warn ""
|
|
||||||
warn "[Y] Yes [N] No [?] Help (default is \"N\")."
|
|
||||||
warn ""
|
|
||||||
|
|
||||||
while true; do
|
# short-circuit script based on platform
|
||||||
read -r stack_answer </dev/tty
|
case "${plat}" in
|
||||||
|
MSYS*|MINGW*)
|
||||||
case $stack_answer in
|
# For windows we always adjust bashrc, since it's inside msys2
|
||||||
[Yy]*)
|
adjust_bashrc $adjust_bashrc_answer
|
||||||
eghcup --cache install stack || warn "Stack installation failed, continuing anyway"
|
;;
|
||||||
break ;;
|
*)
|
||||||
[Nn]* | "")
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
break ;;
|
case $ask_bashrc_answer in
|
||||||
*)
|
1 | 2)
|
||||||
echo "Possible choices are:"
|
echo
|
||||||
echo
|
echo "==============================================================================="
|
||||||
echo "Y - Yes, install stack"
|
echo
|
||||||
echo "N - No, don't install anything more (default)"
|
yellow "In order to run ghc and cabal, start a new shell or"
|
||||||
echo
|
yellow "run 'source $GHCUP_DIR/env' in your current shell session."
|
||||||
echo "Please make your choice and press ENTER."
|
adjust_bashrc $adjust_bashrc_answer
|
||||||
;;
|
;;
|
||||||
esac
|
*)
|
||||||
done
|
echo
|
||||||
|
echo "==============================================================================="
|
||||||
echo "In order to run ghc and cabal, you need to adjust your PATH variable."
|
echo
|
||||||
echo "You may want to source '$GHCUP_DIR/env' in your shell"
|
yellow "In order to run ghc and cabal, you need to adjust your PATH variable."
|
||||||
echo "configuration to do so (e.g. ~/.bashrc)."
|
yellow "You may want to source '$GHCUP_DIR/env' in your shell"
|
||||||
|
yellow "configuration to do so (e.g. ~/.bashrc)."
|
||||||
case $SHELL in
|
;;
|
||||||
*/zsh) # login shell is zsh
|
esac
|
||||||
GHCUP_PROFILE_FILE="$HOME/.zshrc"
|
|
||||||
MY_SHELL="zsh" ;;
|
|
||||||
*/bash) # login shell is bash
|
|
||||||
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
|
||||||
MY_SHELL="bash" ;;
|
|
||||||
*/sh) # login shell is sh, but might be a symlink to bash or zsh
|
|
||||||
if [ -n "${BASH}" ] ; then
|
|
||||||
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
|
||||||
MY_SHELL="bash"
|
|
||||||
elif [ -n "${ZSH_VERSION}" ] ; then
|
|
||||||
GHCUP_PROFILE_FILE="$HOME/.zshrc"
|
|
||||||
MY_SHELL="zsh"
|
|
||||||
else
|
|
||||||
_done
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*/fish) # login shell is fish
|
esac
|
||||||
GHCUP_PROFILE_FILE="$HOME/.config/fish/config.fish"
|
|
||||||
MY_SHELL="fish" ;;
|
|
||||||
*) _done ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
warn ""
|
|
||||||
warn "Detected ${MY_SHELL} shell on your system..."
|
|
||||||
warn "If you want ghcup to automatically add the required PATH variable to \"${GHCUP_PROFILE_FILE}\""
|
|
||||||
warn ""
|
|
||||||
warn "[Y] Yes [N] No [?] Help (default is \"Y\")."
|
|
||||||
warn ""
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
read -r next_answer </dev/tty
|
|
||||||
|
|
||||||
case $next_answer in
|
|
||||||
[Nn]*)
|
|
||||||
_done ;;
|
|
||||||
[Yy]* | "")
|
|
||||||
case $MY_SHELL in
|
|
||||||
"") break ;;
|
|
||||||
fish)
|
|
||||||
mkdir -p "${GHCUP_PROFILE_FILE%/*}"
|
|
||||||
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
|
||||||
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; test -f $GHCUP_DIR/env ; and set -gx PATH \$HOME/.cabal/bin $GHCUP_BIN \$PATH # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
|
||||||
break ;;
|
|
||||||
bash)
|
|
||||||
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
|
||||||
echo "[ -f \"${GHCUP_DIR}/env\" ] && source \"${GHCUP_DIR}/env\" # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
|
||||||
case "${plat}" in
|
|
||||||
"Darwin"|"darwin")
|
|
||||||
if ! grep -q "ghcup-env" "${HOME}/.bash_profile" ; then
|
|
||||||
echo "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
break ;;
|
|
||||||
|
|
||||||
zsh)
|
|
||||||
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
|
||||||
echo "[ -f \"${GHCUP_DIR}/env\" ] && source \"${GHCUP_DIR}/env\" # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
|
||||||
break ;;
|
|
||||||
esac
|
|
||||||
warn "OK! ${GHCUP_PROFILE_FILE} has been modified. Restart your terminal for the changes to take effect,"
|
|
||||||
warn "or type \"source ${GHCUP_DIR}/env\" to apply them in your current terminal session."
|
|
||||||
_done
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Possible choices are:"
|
|
||||||
echo
|
|
||||||
echo "Y - Yes, update my \"${GHCUP_PROFILE_FILE}\" (default)"
|
|
||||||
echo "N - No, don't mess with my configuration"
|
|
||||||
echo
|
|
||||||
echo "Please make your choice and press ENTER."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
_done
|
_done
|
||||||
|
|
||||||
|
|||||||
@@ -13,20 +13,30 @@
|
|||||||
* hls - (optional) A language server for developers to integrate with their editor/IDE"
|
* hls - (optional) A language server for developers to integrate with their editor/IDE"
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
# Run a non-interactive installation
|
# Run an interactive installation
|
||||||
[switch]$Silent,
|
[switch]$Interactive,
|
||||||
# Specify the install root (default: 'C:\')
|
# Specify the install root (default: 'C:\')
|
||||||
[string]$InstallDir,
|
[string]$InstallDir,
|
||||||
# Instead of installing a new MSys2, use an existing installation
|
# Instead of installing a new MSys2, use an existing installation
|
||||||
[string]$ExistingMsys2Dir,
|
[string]$ExistingMsys2Dir,
|
||||||
# Specify the cabal root directory (default: '$InstallDir\cabal')
|
# Specify the cabal root directory (default: '$InstallDir\cabal')
|
||||||
[string]$CabalDir,
|
[string]$CabalDir,
|
||||||
# Perform a quick installation, omitting some expensive operations (you may have to install dependencies yourself later)
|
|
||||||
[bool]$Quick,
|
|
||||||
# Overwrite (or rather backup) a previous install
|
# Overwrite (or rather backup) a previous install
|
||||||
[bool]$Overwrite
|
[switch]$Overwrite,
|
||||||
|
# Specify the bootstrap url (default: 'https://www.haskell.org/ghcup/sh/bootstrap-haskell')
|
||||||
|
[string]$BootstrapUrl,
|
||||||
|
# Run the final bootstrap script via 'bash' instead of a full newly spawned msys2 shell
|
||||||
|
[switch]$InBash,
|
||||||
|
# Whether to install stack as well
|
||||||
|
[switch]$InstallStack,
|
||||||
|
# Whether to install hls as well
|
||||||
|
[switch]$InstallHLS,
|
||||||
|
# Skip adjusting cabal.config with mingw paths
|
||||||
|
[switch]$NoAdjustCabalConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$Silent = !$Interactive
|
||||||
|
|
||||||
function Print-Msg {
|
function Print-Msg {
|
||||||
param ( [Parameter(Mandatory=$true, HelpMessage='String to output')][string]$msg, [string]$color = "Green" )
|
param ( [Parameter(Mandatory=$true, HelpMessage='String to output')][string]$msg, [string]$color = "Green" )
|
||||||
Write-Host ('{0}' -f $msg) -ForegroundColor $color
|
Write-Host ('{0}' -f $msg) -ForegroundColor $color
|
||||||
@@ -151,9 +161,30 @@ $GhcupBasePrefixEnv = [System.Environment]::GetEnvironmentVariable('GHCUP_INSTAL
|
|||||||
if ($GhcupBasePrefixEnv) {
|
if ($GhcupBasePrefixEnv) {
|
||||||
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
||||||
} else {
|
} else {
|
||||||
$defaultGhcupBasePrefix = 'C:\'
|
$partitions = Get-CimInstance win32_logicaldisk
|
||||||
|
$defaultGhcupBasePrefix = $null
|
||||||
|
foreach ($p in $partitions){
|
||||||
|
try {
|
||||||
|
if ($p."FreeSpace" -lt 5368709120) { # at least 5 GB are needed
|
||||||
|
throw ("Not enough free space on {0}" -f $p."DeviceId")
|
||||||
|
}
|
||||||
|
$null = New-Item -Path ('{0}\' -f $p."DeviceId") -Name "ghcup.test" -ItemType "directory" -Force
|
||||||
|
$defaultGhcupBasePrefix = ('{0}\' -f $p."DeviceId")
|
||||||
|
Remove-Item -LiteralPath ('{0}\ghcup.test' -f $p."DeviceId")
|
||||||
|
break
|
||||||
|
} catch {
|
||||||
|
Print-Msg -color Yellow -msg ("{0} not writable or not enough disk space, trying next device" -f $p."DeviceId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($defaultGhcupBasePrefix) {
|
||||||
|
Print-Msg -color Green -msg ("Picked {0} as default Install prefix!" -f $defaultGhcupBasePrefix)
|
||||||
|
} else {
|
||||||
|
Print-Msg -color Red -msg "Couldn't find a writable partition with at least 5GB free disk space!"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ask for base install prefix
|
||||||
if ($Silent -and !($InstallDir)) {
|
if ($Silent -and !($InstallDir)) {
|
||||||
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
||||||
} elseif ($InstallDir) {
|
} elseif ($InstallDir) {
|
||||||
@@ -194,11 +225,14 @@ $null = [Environment]::SetEnvironmentVariable("GHCUP_INSTALL_BASE_PREFIX", $Ghcu
|
|||||||
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
||||||
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
||||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||||
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
if (!($BootstrapUrl)) {
|
||||||
|
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
||||||
|
}
|
||||||
$GhcupMsys2 = [System.Environment]::GetEnvironmentVariable('GHCUP_MSYS2', 'user')
|
$GhcupMsys2 = [System.Environment]::GetEnvironmentVariable('GHCUP_MSYS2', 'user')
|
||||||
|
|
||||||
Print-Msg -msg 'Preparing for GHCup installation...'
|
Print-Msg -msg 'Preparing for GHCup installation...'
|
||||||
|
|
||||||
|
# ask what to do in case ghcup is already installed
|
||||||
if (Test-Path -LiteralPath ('{0}' -f $GhcupDir)) {
|
if (Test-Path -LiteralPath ('{0}' -f $GhcupDir)) {
|
||||||
Print-Msg -msg ('GHCup already installed at ''{0}''...' -f $GhcupDir)
|
Print-Msg -msg ('GHCup already installed at ''{0}''...' -f $GhcupDir)
|
||||||
if ($Overwrite) {
|
if ($Overwrite) {
|
||||||
@@ -228,8 +262,75 @@ if (Test-Path -LiteralPath ('{0}' -f $GhcupDir)) {
|
|||||||
$null = New-Item -Path ('{0}' -f $GhcupDir) -ItemType 'directory' -ErrorAction SilentlyContinue
|
$null = New-Item -Path ('{0}' -f $GhcupDir) -ItemType 'directory' -ErrorAction SilentlyContinue
|
||||||
$null = New-Item -Path ('{0}' -f $GhcupDir) -Name 'bin' -ItemType 'directory' -ErrorAction SilentlyContinue
|
$null = New-Item -Path ('{0}' -f $GhcupDir) -Name 'bin' -ItemType 'directory' -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
Print-Msg -msg 'First checking for Msys2...'
|
# ask for cabal dir destination
|
||||||
|
if ($CabalDir) {
|
||||||
|
$CabDirEnv = $CabalDir
|
||||||
|
if (!($CabDirEnv)) {
|
||||||
|
Print-Msg -color Red -msg "No directory specified!"
|
||||||
|
Exit 1
|
||||||
|
} elseif (!(Split-Path -IsAbsolute -Path "$CabDirEnv")) {
|
||||||
|
Print-Msg -color Red -msg "Invalid/Non-absolute Path specified"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
} elseif (!($Silent)) {
|
||||||
|
while ($true) {
|
||||||
|
|
||||||
|
$defaultCabalDir = ('{0}\cabal' -f $GhcupBasePrefix)
|
||||||
|
Print-Msg -color Magenta -msg ('Specify Cabal directory (this is where haskell packages end up). Press enter to accept the default [{0}]:' -f $defaultCabalDir)
|
||||||
|
$CabalDirPrompt = Read-Host
|
||||||
|
$CabDirEnv = ($defaultCabalDir,$CabalDirPrompt)[[bool]$CabalDirPrompt]
|
||||||
|
|
||||||
|
if (!($CabDirEnv)) {
|
||||||
|
Print-Msg -color Red -msg "No directory specified!"
|
||||||
|
} elseif (!(Split-Path -IsAbsolute -Path "$CabDirEnv")) {
|
||||||
|
Print-Msg -color Red -msg "Invalid/Non-absolute Path specified"
|
||||||
|
} else {
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$CabDirEnv = ('{0}\cabal' -f $GhcupBasePrefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
# ask whether to install HLS
|
||||||
|
if (!($InstallHLS)) {
|
||||||
|
if (!($Silent)) {
|
||||||
|
$HLSdecision = $Host.UI.PromptForChoice('Install HLS'
|
||||||
|
, 'Do you want to install the haskell-language-server (HLS) for development purposes as well?'
|
||||||
|
, [System.Management.Automation.Host.ChoiceDescription[]] @('&Yes'
|
||||||
|
'&No'
|
||||||
|
'&Abort'), 1)
|
||||||
|
|
||||||
|
if ($HLSdecision -eq 0) {
|
||||||
|
$InstallHLS = $true
|
||||||
|
} elseif ($HLSdecision -eq 2) {
|
||||||
|
Exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ask whether to install stack
|
||||||
|
if (!($InstallStack)) {
|
||||||
|
if (!($Silent)) {
|
||||||
|
$StackDecision = $Host.UI.PromptForChoice('Install stack'
|
||||||
|
, 'Do you want to install stack as well?'
|
||||||
|
, [System.Management.Automation.Host.ChoiceDescription[]] @('&Yes'
|
||||||
|
'&No'
|
||||||
|
'&Abort'), 1)
|
||||||
|
|
||||||
|
if ($StackDecision -eq 0) {
|
||||||
|
$InstallStack = $true
|
||||||
|
} elseif ($StackDecision -eq 2) {
|
||||||
|
Exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Print-Msg -msg 'Starting installation in 5 seconds, this may take a while...'
|
||||||
|
Start-Sleep -s 5
|
||||||
|
|
||||||
|
# mingw foo
|
||||||
|
Print-Msg -msg 'First checking for Msys2...'
|
||||||
if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
||||||
if ($Silent) {
|
if ($Silent) {
|
||||||
$msys2Decision = 0
|
$msys2Decision = 0
|
||||||
@@ -268,20 +369,8 @@ if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
|||||||
Print-Msg -msg 'Upgrading full system twice...'
|
Print-Msg -msg 'Upgrading full system twice...'
|
||||||
Exec "$Bash" '-lc' 'pacman --noconfirm -Syuu'
|
Exec "$Bash" '-lc' 'pacman --noconfirm -Syuu'
|
||||||
|
|
||||||
if ($Quick) {
|
Print-Msg -msg 'Installing Dependencies...'
|
||||||
$ghcBuildDeps = $Quick
|
Exec "$Bash" '-lc' 'pacman --noconfirm -S --needed curl mingw-w64-x86_64-pkgconf'
|
||||||
} elseif (!($Silent)) {
|
|
||||||
$ghcBuildDeps = $Host.UI.PromptForChoice('Install Dependencies'
|
|
||||||
, 'Install a standard set of mingw64 packages to be able to build various haskell packages requiring unix libraries? (recommended, however this might take a while... if you skip this, you might have to do it manually later)'
|
|
||||||
, [System.Management.Automation.Host.ChoiceDescription[]] @('&Yes'
|
|
||||||
'&No'), 0)
|
|
||||||
} else {
|
|
||||||
$ghcBuildDeps = 0
|
|
||||||
}
|
|
||||||
if ($ghcBuildDeps -eq 0) {
|
|
||||||
Print-Msg -msg 'Installing Dependencies...'
|
|
||||||
Exec "$Bash" '-lc' 'pacman --noconfirm -S --needed git tar curl wget base-devel gettext binutils autoconf make libtool automake pkgconf python p7zip patch unzip'
|
|
||||||
}
|
|
||||||
|
|
||||||
Print-Msg -msg 'Updating SSL root certificate authorities...'
|
Print-Msg -msg 'Updating SSL root certificate authorities...'
|
||||||
Exec "$Bash" '-lc' 'pacman --noconfirm -S ca-certificates'
|
Exec "$Bash" '-lc' 'pacman --noconfirm -S ca-certificates'
|
||||||
@@ -319,40 +408,16 @@ if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Print-Msg -msg 'Creating shortcuts...'
|
Print-Msg -msg 'Creating shortcuts...'
|
||||||
Create-Shortcut -SourceExe ('{0}\msys2_shell.cmd' -f $MsysDir) -ArgumentsToSourceExe '-mingw64' -DestinationPath ('{0}\Desktop\Mingw haskell shell.lnk' -f $HOME)
|
$DesktopDir = [Environment]::GetFolderPath("Desktop")
|
||||||
Create-Shortcut -SourceExe 'https://www.msys2.org/docs/package-management' -ArgumentsToSourceExe '' -DestinationPath ('{0}\Desktop\Mingw package management docs.url' -f $HOME)
|
$GhcInstArgs = '-mingw64 -mintty -c "pacman --noconfirm -S --needed base-devel gettext autoconf make libtool automake python p7zip patch unzip"'
|
||||||
|
Create-Shortcut -SourceExe ('{0}\msys2_shell.cmd' -f $MsysDir) -ArgumentsToSourceExe $GhcInstArgs -DestinationPath ('{0}\Install GHC dev dependencies.lnk' -f $DesktopDir)
|
||||||
|
Create-Shortcut -SourceExe ('{0}\msys2_shell.cmd' -f $MsysDir) -ArgumentsToSourceExe '-mingw64' -DestinationPath ('{0}\Mingw haskell shell.lnk' -f $DesktopDir)
|
||||||
|
Create-Shortcut -SourceExe 'https://www.msys2.org/docs/package-management' -ArgumentsToSourceExe '' -DestinationPath ('{0}\Mingw package management docs.url' -f $DesktopDir)
|
||||||
|
|
||||||
Print-Msg -msg ('Adding {0}\bin to Users Path...' -f $GhcupDir)
|
Print-Msg -msg ('Adding {0}\bin to Users Path...' -f $GhcupDir)
|
||||||
Add-EnvPath -Path ('{0}\bin' -f ([System.IO.Path]::GetFullPath("$GhcupDir"))) -Container 'User'
|
Add-EnvPath -Path ('{0}\bin' -f ([System.IO.Path]::GetFullPath("$GhcupDir"))) -Container 'User'
|
||||||
|
|
||||||
if ($CabalDir) {
|
|
||||||
$CabDirEnv = $CabalDir
|
|
||||||
if (!($CabDirEnv)) {
|
|
||||||
Print-Msg -color Red -msg "No directory specified!"
|
|
||||||
Exit 1
|
|
||||||
} elseif (!(Split-Path -IsAbsolute -Path "$CabDirEnv")) {
|
|
||||||
Print-Msg -color Red -msg "Invalid/Non-absolute Path specified"
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
} elseif (!($Silent)) {
|
|
||||||
while ($true) {
|
|
||||||
|
|
||||||
$defaultCabalDir = ('{0}\cabal' -f $GhcupBasePrefix)
|
|
||||||
Print-Msg -color Magenta -msg ('Specify Cabal directory (this is where haskell packages end up). Press enter to accept the default [{0}]:' -f $defaultCabalDir)
|
|
||||||
$CabalDirPrompt = Read-Host
|
|
||||||
$CabDirEnv = ($defaultCabalDir,$CabalDirPrompt)[[bool]$CabalDirPrompt]
|
|
||||||
|
|
||||||
if (!($CabDirEnv)) {
|
|
||||||
Print-Msg -color Red -msg "No directory specified!"
|
|
||||||
} elseif (!(Split-Path -IsAbsolute -Path "$CabDirEnv")) {
|
|
||||||
Print-Msg -color Red -msg "Invalid/Non-absolute Path specified"
|
|
||||||
} else {
|
|
||||||
Break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$CabDirEnv = ('{0}\cabal' -f $GhcupBasePrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
$CabalDirFull = [System.IO.Path]::GetFullPath("$CabDirEnv")
|
$CabalDirFull = [System.IO.Path]::GetFullPath("$CabDirEnv")
|
||||||
Print-Msg -msg ('Setting CABAL_DIR to ''{0}''' -f $CabalDirFull)
|
Print-Msg -msg ('Setting CABAL_DIR to ''{0}''' -f $CabalDirFull)
|
||||||
@@ -362,16 +427,25 @@ Print-Msg -msg 'Starting GHCup installer...'
|
|||||||
|
|
||||||
$Msys2Shell = ('{0}\msys2_shell.cmd' -f $MsysDir)
|
$Msys2Shell = ('{0}\msys2_shell.cmd' -f $MsysDir)
|
||||||
|
|
||||||
if ($Silent) {
|
# The bootstrap script is always silent, since we ask relevant questions here
|
||||||
$SilentExport = 'export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 ;'
|
$SilentExport = 'export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 ;'
|
||||||
} else {
|
|
||||||
$SilentExport = ''
|
if ($InstallStack) {
|
||||||
|
$StackInstallExport = 'export BOOTSTRAP_HASKELL_INSTALL_STACK=1 ;'
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell")) {
|
if ($InstallHLS) {
|
||||||
Exec "$Bash" '-lc' ('{4} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull)
|
$HLSInstallExport = 'export BOOTSTRAP_HASKELL_INSTALL_HLS=1 ;'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($NoAdjustCabalConfig)) {
|
||||||
|
$AdjustCabalConfigExport = 'export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=1 ;'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell") -Or $InBash) {
|
||||||
|
Exec "$Bash" '-lc' ('{4} {6} {7} {8} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport)
|
||||||
} else {
|
} else {
|
||||||
Exec "$Msys2Shell" '-mingw64' '-mintty' '-c' ('{4} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; curl --proto =https --tlsv1.2 -sSf -k {0} | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull)
|
Exec "$Msys2Shell" '-mingw64' '-mintty' '-c' ('{4} {6} {7} {8} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -399,3 +473,9 @@ if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell")) {
|
|||||||
# E5VhEwLBnwzWrvLKtdEclhgUCo5Tq87QMXVdgX4aRmunl4ZE+Q==
|
# E5VhEwLBnwzWrvLKtdEclhgUCo5Tq87QMXVdgX4aRmunl4ZE+Q==
|
||||||
# SIG # End signature block
|
# SIG # End signature block
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
packages: ./ghcup.cabal
|
packages: ./ghcup.cabal
|
||||||
|
|
||||||
|
optional-packages: ./vendored/*/*.cabal
|
||||||
|
|
||||||
optimization: 2
|
optimization: 2
|
||||||
|
|
||||||
package ghcup
|
package ghcup
|
||||||
|
|||||||
@@ -1868,7 +1868,7 @@ ghcupDownloads:
|
|||||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.0.0/cabal-install-3.4.0.0-armv7-linux-bootstrapped.tar.xz
|
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.0.0/cabal-install-3.4.0.0-armv7-linux-bootstrapped.tar.xz
|
||||||
dlHash: 16c0d1eaba24bed14f3e152970179a45d9f9bb5cc839b2c210ad06eb7d4826ed
|
dlHash: 16c0d1eaba24bed14f3e152970179a45d9f9bb5cc839b2c210ad06eb7d4826ed
|
||||||
GHCup:
|
GHCup:
|
||||||
0.1.15.1:
|
0.1.15.2:
|
||||||
viTags:
|
viTags:
|
||||||
- Recommended
|
- Recommended
|
||||||
- Latest
|
- Latest
|
||||||
@@ -1878,39 +1878,39 @@ ghcupDownloads:
|
|||||||
A_64:
|
A_64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-64
|
unknown_versioning: &ghcup-64
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-linux-ghcup-0.1.15.2
|
||||||
dlHash: 871c9dc1bfbf7df6fe3b9b7250c20a3dae8a7aee171712a3e63689ab75bc9439
|
dlHash: 1eb1bb318a327754f42eaa2245bc81fe53be7c791160d28a186893ded3004ed7
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-apple-darwin-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-apple-darwin-ghcup-0.1.15.2
|
||||||
dlHash: 7cd67b554fc58c4ffb224b73e369c5dd27c5276c01f102f6423230b34cc635bc
|
dlHash: c2a6436a49f19f108493954d4a3efcb27503e343dd6288c2641784d32320b1ea
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-portbld-freebsd-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-portbld-freebsd-ghcup-0.1.15.2
|
||||||
dlHash: b4ad9c9f1a878560e8f770d985d53b8fb70582baf99e40e53ec9ee97dc47ae64
|
dlHash: 7e0c17dd78ebd9fd03e6ecea278c192bac31ca333721bde5b0ef99438b847a20
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-64
|
unknown_versioning: *ghcup-64
|
||||||
A_32:
|
A_32:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-32
|
unknown_versioning: &ghcup-32
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/i386-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/i386-linux-ghcup-0.1.15.2
|
||||||
dlHash: 0c1dcbdd7cfa8accdfbe14c623924f3ca29a35d32a2ac3e61f0eb322855e2cb1
|
dlHash: 3b1fe710cded0398e920ec9716089ba65226abf181741897f387e7c539a619c2
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-32
|
unknown_versioning: *ghcup-32
|
||||||
A_ARM64:
|
A_ARM64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/aarch64-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-linux-ghcup-0.1.15.2
|
||||||
dlHash: 7fa29d8e9a9fe3d1e3a63a1d16fc3550128edbdb9b5b5dff7974358c4dab192c
|
dlHash: d91b7a5416f292f2cf813824eb419f76ad9976d258cee3581123cb6eb01db9a7
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/aarch64-apple-darwin-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-apple-darwin-ghcup-0.1.15.2
|
||||||
dlHash: 6a743cd50e8124ac2de8be77013d49dcf3b99ce7cc463ec86ed99a904a51dfd9
|
dlHash: 20625ba5e7488f2a6155331750ecead3815ea16b2695c20521633c1412f012cc
|
||||||
A_ARM:
|
A_ARM:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/armv7-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/armv7-linux-ghcup-0.1.15.2
|
||||||
dlHash: 77ee5d9828c2ba771127274e301e81412b9f29af2d65dd85dada4786d9438c2c
|
dlHash: 03a4af5ed895ada1dd21f4cc3f64dc9078a5bf4268313021d004c04bea7f9c2e
|
||||||
HLS:
|
HLS:
|
||||||
1.1.0:
|
1.1.0:
|
||||||
viTags:
|
viTags:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
globalTools:
|
globalTools:
|
||||||
ShimGen:
|
ShimGen:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/shimgen/gs.exe
|
dlUri: https://downloads.haskell.org/~ghcup/shimgen/shim-2.exe
|
||||||
dlHash: 9ce8b7dad7ff4e5017dbd63d6f6f3d16412b889560cb6ccd3903dbcab0bf4f0d
|
dlHash: 7c55e201f71860c5babea886007c8fa44b861abf50d1c07e5677eb0bda387a70
|
||||||
toolRequirements:
|
toolRequirements:
|
||||||
GHC:
|
GHC:
|
||||||
unknown_version:
|
unknown_version:
|
||||||
@@ -2024,7 +2024,7 @@ ghcupDownloads:
|
|||||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.0.0/cabal-install-3.4.0.0-armv7-linux-bootstrapped.tar.xz
|
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.4.0.0/cabal-install-3.4.0.0-armv7-linux-bootstrapped.tar.xz
|
||||||
dlHash: 16c0d1eaba24bed14f3e152970179a45d9f9bb5cc839b2c210ad06eb7d4826ed
|
dlHash: 16c0d1eaba24bed14f3e152970179a45d9f9bb5cc839b2c210ad06eb7d4826ed
|
||||||
GHCup:
|
GHCup:
|
||||||
0.1.15.1:
|
0.1.15.2:
|
||||||
viTags:
|
viTags:
|
||||||
- Recommended
|
- Recommended
|
||||||
- Latest
|
- Latest
|
||||||
@@ -2034,48 +2034,46 @@ ghcupDownloads:
|
|||||||
A_64:
|
A_64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-64
|
unknown_versioning: &ghcup-64
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-linux-ghcup-0.1.15.2
|
||||||
dlHash: 871c9dc1bfbf7df6fe3b9b7250c20a3dae8a7aee171712a3e63689ab75bc9439
|
dlHash: 1eb1bb318a327754f42eaa2245bc81fe53be7c791160d28a186893ded3004ed7
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-apple-darwin-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-apple-darwin-ghcup-0.1.15.2
|
||||||
dlHash: 7cd67b554fc58c4ffb224b73e369c5dd27c5276c01f102f6423230b34cc635bc
|
dlHash: c2a6436a49f19f108493954d4a3efcb27503e343dd6288c2641784d32320b1ea
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-portbld-freebsd-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-portbld-freebsd-ghcup-0.1.15.2
|
||||||
dlHash: b4ad9c9f1a878560e8f770d985d53b8fb70582baf99e40e53ec9ee97dc47ae64
|
dlHash: 7e0c17dd78ebd9fd03e6ecea278c192bac31ca333721bde5b0ef99438b847a20
|
||||||
Windows:
|
Windows:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/x86_64-mingw64-ghcup-0.1.15.1.exe
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/x86_64-mingw64-ghcup-0.1.15.2.exe
|
||||||
dlHash: 045bac4620fc9d1119ed4961aeba46b616ed572dd11b7d35b48caf58eea08d0f
|
dlHash: 4d832052754379531ac472aeef35666e433acfee79d4079826b8ede8ca5de520
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-64
|
unknown_versioning: *ghcup-64
|
||||||
A_32:
|
A_32:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-32
|
unknown_versioning: &ghcup-32
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/i386-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/i386-linux-ghcup-0.1.15.2
|
||||||
dlHash: 0c1dcbdd7cfa8accdfbe14c623924f3ca29a35d32a2ac3e61f0eb322855e2cb1
|
dlHash: 3b1fe710cded0398e920ec9716089ba65226abf181741897f387e7c539a619c2
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-32
|
unknown_versioning: *ghcup-32
|
||||||
A_ARM64:
|
A_ARM64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/aarch64-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-linux-ghcup-0.1.15.2-r1
|
||||||
dlHash: 7fa29d8e9a9fe3d1e3a63a1d16fc3550128edbdb9b5b5dff7974358c4dab192c
|
dlHash: d853372440f3d43babbb868fad399811241760f2233829c92403fcbea8c547ec
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/aarch64-apple-darwin-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-apple-darwin-ghcup-0.1.15.2
|
||||||
dlHash: 6a743cd50e8124ac2de8be77013d49dcf3b99ce7cc463ec86ed99a904a51dfd9
|
dlHash: 20625ba5e7488f2a6155331750ecead3815ea16b2695c20521633c1412f012cc
|
||||||
A_ARM:
|
A_ARM:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.1/armv7-linux-ghcup-0.1.15.1
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/armv7-linux-ghcup-0.1.15.2-r1
|
||||||
dlHash: 77ee5d9828c2ba771127274e301e81412b9f29af2d65dd85dada4786d9438c2c
|
dlHash: f8add9b39e1f7d0f03904dc69a8683259972a4472432c1ade27d918c39a4a874
|
||||||
HLS:
|
HLS:
|
||||||
1.1.0:
|
1.1.0:
|
||||||
viTags:
|
viTags: []
|
||||||
- Recommended
|
|
||||||
- Latest
|
|
||||||
viChangeLog: https://github.com/haskell/haskell-language-server/blob/master/ChangeLog.md#110
|
viChangeLog: https://github.com/haskell/haskell-language-server/blob/master/ChangeLog.md#110
|
||||||
viPostInstall: "This is just the server part of your LSP configuration. Consult the README on how to configure HLS, your project and your LSP client in your editor: https://github.com/haskell/haskell-language-server/blob/master/README.md"
|
viPostInstall: "This is just the server part of your LSP configuration. Consult the README on how to configure HLS, your project and your LSP client in your editor: https://github.com/haskell/haskell-language-server/blob/master/README.md"
|
||||||
viArch:
|
viArch:
|
||||||
@@ -2094,14 +2092,45 @@ ghcupDownloads:
|
|||||||
dlHash: a1d3f451e64a041aa527a25da29e4716a2de6ae347cef4ef9312fc7611e168cc
|
dlHash: a1d3f451e64a041aa527a25da29e4716a2de6ae347cef4ef9312fc7611e168cc
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *hls-64
|
unknown_versioning: *hls-64
|
||||||
|
1.2.0:
|
||||||
|
viTags:
|
||||||
|
- Recommended
|
||||||
|
- Latest
|
||||||
|
viChangeLog: https://github.com/haskell/haskell-language-server/blob/master/ChangeLog.md#120
|
||||||
|
viPostInstall: "This is just the server part of your LSP configuration. Consult the README on how to configure HLS, your project and your LSP client in your editor: https://github.com/haskell/haskell-language-server/blob/master/README.md"
|
||||||
|
viArch:
|
||||||
|
A_64:
|
||||||
|
Linux_UnknownLinux:
|
||||||
|
unknown_versioning: &hls-64
|
||||||
|
dlUri: https://github.com/haskell/haskell-language-server/releases/download/1.2.0/haskell-language-server-Linux-1.2.0.tar.gz
|
||||||
|
dlHash: d29ee22f7bd706da2e2a1bd7640e25bb9736adeafb34eef47d29ea143b0fa927
|
||||||
|
Darwin:
|
||||||
|
unknown_versioning:
|
||||||
|
dlUri: https://github.com/haskell/haskell-language-server/releases/download/1.2.0/haskell-language-server-macOS-1.2.0.tar.gz
|
||||||
|
dlHash: a310d8a3e9c5c4218210f750682c74a0f82ad0f59995adde0dbe775115b1e357
|
||||||
|
Windows:
|
||||||
|
unknown_versioning:
|
||||||
|
dlUri: https://github.com/haskell/haskell-language-server/releases/download/1.2.0/haskell-language-server-Windows-1.2.0.tar.gz
|
||||||
|
dlHash: 961c6ff12c9a9c7a4609f239c5ac70d7d16753cdb8c10348a6a51feeaa0b6aea
|
||||||
|
Linux_Alpine:
|
||||||
|
unknown_versioning: *hls-64
|
||||||
Stack:
|
Stack:
|
||||||
2.5.1:
|
2.5.1:
|
||||||
viTags:
|
viTags:
|
||||||
- old
|
- old
|
||||||
viChangeLog: https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md#v251
|
viChangeLog: https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md#v251
|
||||||
viPostInstall: &stack-post |
|
viPostInstall: &stack-post |
|
||||||
Stack manages GHC versions internally by default. In order to make it use ghcup installed GHC versions have a look at the options 'system-ghc', 'compiler-check' and 'compiler': https://docs.haskellstack.org/en/stable/yaml_configuration/#system-ghc
|
Stack manages GHC versions internally by default. In order to make it use ghcup installed
|
||||||
Additionally, you should upgrade stack only through ghcup.
|
GHC versions you can run the following commands:
|
||||||
|
stack config set install-ghc false --global
|
||||||
|
stack config set system-ghc true --global
|
||||||
|
|
||||||
|
On windows, you may find the following config options useful too:
|
||||||
|
skip-msys, extra-path, extra-include-dirs, extra-lib-dirs
|
||||||
|
|
||||||
|
Also check out: https://docs.haskellstack.org/en/stable/yaml_configuration
|
||||||
|
|
||||||
|
!!! Additionally, you should upgrade stack only through ghcup and not use 'stack upgrade' !!!
|
||||||
viArch:
|
viArch:
|
||||||
A_64:
|
A_64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
|
|||||||
12
ghcup.cabal
12
ghcup.cabal
@@ -43,9 +43,7 @@ flag internal-downloader
|
|||||||
manual: True
|
manual: True
|
||||||
|
|
||||||
flag tar
|
flag tar
|
||||||
description:
|
description: Use tar-bytestring instead of libarchive.
|
||||||
Use tar-bytestring instead of libarchive.
|
|
||||||
|
|
||||||
default: False
|
default: False
|
||||||
manual: True
|
manual: True
|
||||||
|
|
||||||
@@ -142,7 +140,7 @@ library
|
|||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, utf8-string ^>=1.0
|
, utf8-string ^>=1.0
|
||||||
, vector ^>=0.12
|
, vector ^>=0.12
|
||||||
, versions ^>=4.0.1
|
, versions >=4.0.1 && <5.1
|
||||||
, word8 ^>=0.1.3
|
, word8 ^>=0.1.3
|
||||||
, yaml ^>=0.11.4.0
|
, yaml ^>=0.11.4.0
|
||||||
, zip ^>=1.7.1
|
, zip ^>=1.7.1
|
||||||
@@ -226,7 +224,7 @@ executable ghcup
|
|||||||
, text ^>=1.2.4.0
|
, text ^>=1.2.4.0
|
||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, utf8-string ^>=1.0
|
, utf8-string ^>=1.0
|
||||||
, versions ^>=4.0.1
|
, versions >=4.0.1 && <5.1
|
||||||
|
|
||||||
if flag(internal-downloader)
|
if flag(internal-downloader)
|
||||||
cpp-options: -DINTERNAL_DOWNLOADER
|
cpp-options: -DINTERNAL_DOWNLOADER
|
||||||
@@ -294,7 +292,7 @@ executable ghcup-gen
|
|||||||
, text ^>=1.2.4.0
|
, text ^>=1.2.4.0
|
||||||
, transformers ^>=0.5
|
, transformers ^>=0.5
|
||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, versions ^>=4.0.1
|
, versions >=4.0.1 && <5.1
|
||||||
, yaml ^>=0.11.4.0
|
, yaml ^>=0.11.4.0
|
||||||
|
|
||||||
if flag(tar)
|
if flag(tar)
|
||||||
@@ -338,4 +336,4 @@ test-suite ghcup-test
|
|||||||
, quickcheck-arbitrary-adt ^>=0.3.1.0
|
, quickcheck-arbitrary-adt ^>=0.3.1.0
|
||||||
, text ^>=1.2.4.0
|
, text ^>=1.2.4.0
|
||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, versions ^>=4.0.1
|
, versions >=4.0.1 && <5.1
|
||||||
|
|||||||
232
lib/GHCup.hs
232
lib/GHCup.hs
@@ -42,6 +42,7 @@ import GHCup.Version
|
|||||||
import Codec.Archive ( ArchiveResult )
|
import Codec.Archive ( ArchiveResult )
|
||||||
#endif
|
#endif
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Control.Exception ( evaluate )
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
@@ -1282,6 +1283,187 @@ rmStackVer ver = do
|
|||||||
Nothing -> liftIO $ rmLink (binDir </> "stack" <> exeExt)
|
Nothing -> liftIO $ rmLink (binDir </> "stack" <> exeExt)
|
||||||
|
|
||||||
|
|
||||||
|
-- assuming the current scheme of having just 1 ghcup bin, no version info is required.
|
||||||
|
rmGhcup :: ( MonadReader AppState m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadCatch m
|
||||||
|
, MonadLogger m
|
||||||
|
)
|
||||||
|
=> m ()
|
||||||
|
|
||||||
|
rmGhcup = do
|
||||||
|
AppState {dirs = Dirs {binDir}} <- ask
|
||||||
|
let ghcupFilename = "ghcup" <> exeExt
|
||||||
|
let ghcupFilepath = binDir </> ghcupFilename
|
||||||
|
|
||||||
|
currentRunningExecPath <- liftIO getExecutablePath
|
||||||
|
|
||||||
|
-- if paths do no exist, warn user, and continue to compare them, as is,
|
||||||
|
-- which should eventually fail and result in a non-standard install warning
|
||||||
|
|
||||||
|
p1 <- handleIO' doesNotExistErrorType
|
||||||
|
(handlePathNotPresent currentRunningExecPath)
|
||||||
|
(liftIO $ canonicalizePath currentRunningExecPath)
|
||||||
|
|
||||||
|
p2 <- handleIO' doesNotExistErrorType
|
||||||
|
(handlePathNotPresent ghcupFilepath)
|
||||||
|
(liftIO $ canonicalizePath ghcupFilepath)
|
||||||
|
|
||||||
|
let areEqualPaths = equalFilePath p1 p2
|
||||||
|
|
||||||
|
unless areEqualPaths $ $logWarn $ nonStandardInstallLocationMsg currentRunningExecPath
|
||||||
|
|
||||||
|
#if defined(IS_WINDOWS)
|
||||||
|
-- since it doesn't seem possible to delete a running exec in windows
|
||||||
|
-- we move it to temp dir, to be deleted at next reboot
|
||||||
|
tempDir <- liftIO $ getTemporaryDirectory
|
||||||
|
let tempFilepath = tempDir </> ghcupFilename
|
||||||
|
hideError UnsupportedOperation $
|
||||||
|
liftIO $ hideError NoSuchThing $
|
||||||
|
Win32.moveFileEx ghcupFilepath (Just tempFilepath) Win32.mOVEFILE_REPLACE_EXISTING
|
||||||
|
#else
|
||||||
|
-- delete it.
|
||||||
|
hideError doesNotExistErrorType $ liftIO $ rmFile ghcupFilepath
|
||||||
|
#endif
|
||||||
|
|
||||||
|
where
|
||||||
|
handlePathNotPresent fp _err = do
|
||||||
|
$logDebug $ "Error: The path does not exist, " <> T.pack fp
|
||||||
|
pure fp
|
||||||
|
|
||||||
|
nonStandardInstallLocationMsg path = T.pack $
|
||||||
|
"current ghcup is invoked from a non-standard location: \n"
|
||||||
|
<> path <>
|
||||||
|
"\n you may have to uninstall it manually."
|
||||||
|
|
||||||
|
rmTool :: ( MonadReader AppState m
|
||||||
|
, MonadLogger m
|
||||||
|
, MonadFail m
|
||||||
|
, MonadMask m
|
||||||
|
, MonadUnliftIO m)
|
||||||
|
=> ListResult
|
||||||
|
-> Excepts '[NotInstalled ] m ()
|
||||||
|
|
||||||
|
rmTool ListResult {lVer, lTool, lCross} = do
|
||||||
|
case lTool of
|
||||||
|
GHC ->
|
||||||
|
let ghcTargetVersion = GHCTargetVersion lCross lVer
|
||||||
|
in rmGHCVer ghcTargetVersion
|
||||||
|
HLS -> rmHLSVer lVer
|
||||||
|
Cabal -> rmCabalVer lVer
|
||||||
|
Stack -> rmStackVer lVer
|
||||||
|
GHCup -> lift rmGhcup
|
||||||
|
|
||||||
|
|
||||||
|
rmGhcupDirs :: ( MonadReader AppState m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadLogger m
|
||||||
|
, MonadCatch m
|
||||||
|
, MonadMask m )
|
||||||
|
=> m [FilePath]
|
||||||
|
rmGhcupDirs = do
|
||||||
|
Dirs
|
||||||
|
{ baseDir
|
||||||
|
, binDir
|
||||||
|
, logsDir
|
||||||
|
, cacheDir
|
||||||
|
} <- asks dirs
|
||||||
|
|
||||||
|
let envFilePath = baseDir </> "env"
|
||||||
|
|
||||||
|
confFilePath <- getConfigFilePath
|
||||||
|
|
||||||
|
rmEnvFile envFilePath
|
||||||
|
rmConfFile confFilePath
|
||||||
|
rmDir cacheDir
|
||||||
|
rmDir logsDir
|
||||||
|
rmBinDir binDir
|
||||||
|
#if defined(IS_WINDOWS)
|
||||||
|
rmDir (baseDir </> "msys64")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
liftIO $ removeEmptyDirsRecursive baseDir
|
||||||
|
|
||||||
|
-- report files in baseDir that are left-over after
|
||||||
|
-- the standard location deletions above
|
||||||
|
hideErrorDef [doesNotExistErrorType] [] $ reportRemainingFiles baseDir
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
rmEnvFile :: (MonadCatch m, MonadLogger m, MonadIO m) => FilePath -> m ()
|
||||||
|
rmEnvFile enFilePath = do
|
||||||
|
$logInfo "Removing Ghcup Environment File"
|
||||||
|
hideError doesNotExistErrorType $ liftIO $ deleteFile enFilePath
|
||||||
|
|
||||||
|
rmConfFile :: (MonadCatch m, MonadLogger m, MonadIO m) => FilePath -> m ()
|
||||||
|
rmConfFile confFilePath = do
|
||||||
|
$logInfo "removing Ghcup Config File"
|
||||||
|
hideError doesNotExistErrorType $ liftIO $ deleteFile confFilePath
|
||||||
|
|
||||||
|
rmDir :: (MonadLogger m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
||||||
|
rmDir dir = do
|
||||||
|
$logInfo [i|removing #{dir}|]
|
||||||
|
contents <- hideErrorDef [doesNotExistErrorType] []
|
||||||
|
$ liftIO
|
||||||
|
(getDirectoryContentsRecursive dir >>= evaluate)
|
||||||
|
forM_ contents (liftIO . deleteFile . (dir </>))
|
||||||
|
|
||||||
|
rmBinDir :: (MonadCatch m, MonadIO m) => FilePath -> m ()
|
||||||
|
rmBinDir binDir = do
|
||||||
|
#if !defined(IS_WINDOWS)
|
||||||
|
isXDGStyle <- liftIO useXDG
|
||||||
|
if not isXDGStyle
|
||||||
|
then removeDirIfEmptyOrIsSymlink binDir
|
||||||
|
else pure ()
|
||||||
|
#else
|
||||||
|
removeDirIfEmptyOrIsSymlink binDir
|
||||||
|
#endif
|
||||||
|
|
||||||
|
reportRemainingFiles :: MonadIO m => FilePath -> m [FilePath]
|
||||||
|
reportRemainingFiles dir = do
|
||||||
|
remainingFiles <- liftIO $ getDirectoryContentsRecursive dir
|
||||||
|
let normalizedFilePaths = fmap normalise remainingFiles
|
||||||
|
let sortedByDepthRemainingFiles = sortBy (flip compareFn) normalizedFilePaths
|
||||||
|
let remainingFilesAbsolute = fmap (dir </>) sortedByDepthRemainingFiles
|
||||||
|
|
||||||
|
pure remainingFilesAbsolute
|
||||||
|
|
||||||
|
where
|
||||||
|
calcDepth :: FilePath -> Int
|
||||||
|
calcDepth = length . filter isPathSeparator
|
||||||
|
|
||||||
|
compareFn :: FilePath -> FilePath -> Ordering
|
||||||
|
compareFn fp1 fp2 = compare (calcDepth fp1) (calcDepth fp2)
|
||||||
|
|
||||||
|
removeEmptyDirsRecursive :: FilePath -> IO ()
|
||||||
|
removeEmptyDirsRecursive fp = do
|
||||||
|
cs <- listDirectory fp >>= filterM doesDirectoryExist . fmap (fp </>)
|
||||||
|
forM_ cs removeEmptyDirsRecursive
|
||||||
|
hideError InappropriateType $ removeDirIfEmptyOrIsSymlink fp
|
||||||
|
|
||||||
|
|
||||||
|
-- we expect only files inside cache/log dir
|
||||||
|
-- we report remaining files/dirs later,
|
||||||
|
-- hence the force/quiet mode in these delete functions below.
|
||||||
|
|
||||||
|
deleteFile :: FilePath -> IO ()
|
||||||
|
deleteFile filepath = do
|
||||||
|
hideError InappropriateType $ rmFile filepath
|
||||||
|
|
||||||
|
removeDirIfEmptyOrIsSymlink :: (MonadCatch m, MonadIO m) => FilePath -> m ()
|
||||||
|
removeDirIfEmptyOrIsSymlink filepath =
|
||||||
|
hideError UnsatisfiedConstraints $
|
||||||
|
handleIO' InappropriateType
|
||||||
|
(handleIfSym filepath)
|
||||||
|
(liftIO $ removeDirectory filepath)
|
||||||
|
where
|
||||||
|
handleIfSym fp e = do
|
||||||
|
isSym <- liftIO $ pathIsSymbolicLink fp
|
||||||
|
if isSym
|
||||||
|
then liftIO $ deleteFile fp
|
||||||
|
else liftIO $ ioError e
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
--[ Debug info ]--
|
--[ Debug info ]--
|
||||||
@@ -1623,14 +1805,14 @@ upgradeGHCup :: ( MonadMask m
|
|||||||
]
|
]
|
||||||
m
|
m
|
||||||
Version
|
Version
|
||||||
upgradeGHCup mtarget force = do
|
upgradeGHCup mtarget force' = do
|
||||||
AppState { dirs = Dirs {..}
|
AppState { dirs = Dirs {..}
|
||||||
, pfreq
|
, pfreq
|
||||||
, ghcupInfo = GHCupInfo { _ghcupDownloads = dls }
|
, ghcupInfo = GHCupInfo { _ghcupDownloads = dls }
|
||||||
, settings } <- lift ask
|
, settings } <- lift ask
|
||||||
lift $ $(logInfo) [i|Upgrading GHCup...|]
|
lift $ $(logInfo) [i|Upgrading GHCup...|]
|
||||||
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
||||||
when (not force && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate
|
when (not force' && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate
|
||||||
dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls
|
dli <- lE $ getDownloadInfo GHCup latestVer pfreq dls
|
||||||
tmp <- lift withGHCupTmpDir
|
tmp <- lift withGHCupTmpDir
|
||||||
let fn = "ghcup" <> exeExt
|
let fn = "ghcup" <> exeExt
|
||||||
@@ -1698,3 +1880,49 @@ postGHCInstall ver@GHCTargetVersion {..} = do
|
|||||||
$ getMajorMinorV _tvVersion
|
$ getMajorMinorV _tvVersion
|
||||||
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
||||||
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
||||||
|
|
||||||
|
|
||||||
|
-- | Reports the binary location of a given tool:
|
||||||
|
--
|
||||||
|
-- * for GHC, this reports: @~\/.ghcup\/ghc\/\<ver\>\/bin\/ghc@
|
||||||
|
-- * for cabal, this reports @~\/.ghcup\/bin\/cabal-\<ver\>@
|
||||||
|
-- * for hls, this reports @~\/.ghcup\/bin\/haskell-language-server-wrapper-\<ver\>@
|
||||||
|
-- * for stack, this reports @~\/.ghcup\/bin\/stack-\<ver\>@
|
||||||
|
-- * for ghcup, this reports the location of the currently running executable
|
||||||
|
whereIsTool :: ( MonadReader AppState m
|
||||||
|
, MonadLogger m
|
||||||
|
, MonadThrow m
|
||||||
|
, MonadFail m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadCatch m
|
||||||
|
, MonadMask m
|
||||||
|
, MonadUnliftIO m
|
||||||
|
)
|
||||||
|
=> Tool
|
||||||
|
-> GHCTargetVersion
|
||||||
|
-> Excepts '[NotInstalled] m FilePath
|
||||||
|
whereIsTool tool ver@GHCTargetVersion {..} = do
|
||||||
|
AppState { dirs } <- lift ask
|
||||||
|
|
||||||
|
case tool of
|
||||||
|
GHC -> do
|
||||||
|
whenM (lift $ fmap not $ ghcInstalled ver)
|
||||||
|
$ throwE (NotInstalled GHC ver)
|
||||||
|
bdir <- lift $ ghcupGHCDir ver
|
||||||
|
pure (bdir </> "bin" </> "ghc" <> exeExt)
|
||||||
|
Cabal -> do
|
||||||
|
whenM (lift $ fmap not $ cabalInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled Cabal (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "cabal-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
HLS -> do
|
||||||
|
whenM (lift $ fmap not $ hlsInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled HLS (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "haskell-language-server-wrapper-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
|
||||||
|
Stack -> do
|
||||||
|
whenM (lift $ fmap not $ stackInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled Stack (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "stack-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
GHCup -> do
|
||||||
|
currentRunningExecPath <- liftIO getExecutablePath
|
||||||
|
liftIO $ canonicalizePath currentRunningExecPath
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ module GHCup.Utils.Dirs
|
|||||||
, parseGHCupGHCDir
|
, parseGHCupGHCDir
|
||||||
, relativeSymlink
|
, relativeSymlink
|
||||||
, withGHCupTmpDir
|
, withGHCupTmpDir
|
||||||
|
, getConfigFilePath
|
||||||
|
#if !defined(IS_WINDOWS)
|
||||||
|
, useXDG
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@@ -201,13 +205,16 @@ getDirs = do
|
|||||||
--[ GHCup files ]--
|
--[ GHCup files ]--
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
getConfigFilePath :: (MonadIO m) => m FilePath
|
||||||
|
getConfigFilePath = do
|
||||||
|
confDir <- liftIO ghcupConfigDir
|
||||||
|
pure $ confDir </> "config.yaml"
|
||||||
|
|
||||||
ghcupConfigFile :: (MonadIO m)
|
ghcupConfigFile :: (MonadIO m)
|
||||||
=> Excepts '[JSONError] m UserSettings
|
=> Excepts '[JSONError] m UserSettings
|
||||||
ghcupConfigFile = do
|
ghcupConfigFile = do
|
||||||
confDir <- liftIO ghcupConfigDir
|
filepath <- getConfigFilePath
|
||||||
let file = confDir </> "config.yaml"
|
contents <- liftIO $ handleIO' NoSuchThing (\_ -> pure Nothing) $ Just <$> BS.readFile filepath
|
||||||
contents <- liftIO $ handleIO' NoSuchThing (\_ -> pure Nothing) $ Just <$> BS.readFile file
|
|
||||||
case contents of
|
case contents of
|
||||||
Nothing -> pure defaultUserSettings
|
Nothing -> pure defaultUserSettings
|
||||||
Just contents' -> lE' JSONDecodeError . first show . Y.decodeEither' $ contents'
|
Just contents' -> lE' JSONDecodeError . first show . Y.decodeEither' $ contents'
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import GHCup.Utils.String.QQ
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Control.Monad.Logger
|
import Control.Monad.Logger
|
||||||
|
import Data.Char ( ord )
|
||||||
import Prelude hiding ( appendFile )
|
import Prelude hiding ( appendFile )
|
||||||
import System.Console.Pretty
|
import System.Console.Pretty
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
@@ -43,20 +44,33 @@ myLoggerT LoggerConfig {..} loggingt = runLoggingT loggingt mylogger
|
|||||||
mylogger :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
|
mylogger :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
|
||||||
mylogger _ _ level str' = do
|
mylogger _ _ level str' = do
|
||||||
-- color output
|
-- color output
|
||||||
|
let style' = case level of
|
||||||
|
LevelDebug -> style Bold . color Blue
|
||||||
|
LevelInfo -> style Bold . color Green
|
||||||
|
LevelWarn -> style Bold . color Yellow
|
||||||
|
LevelError -> style Bold . color Red
|
||||||
|
LevelOther _ -> id
|
||||||
let l = case level of
|
let l = case level of
|
||||||
LevelDebug -> toLogStr (style Bold $ color Blue "[ Debug ]")
|
LevelDebug -> toLogStr (style' "[ Debug ]")
|
||||||
LevelInfo -> toLogStr (style Bold $ color Green "[ Info ]")
|
LevelInfo -> toLogStr (style' "[ Info ]")
|
||||||
LevelWarn -> toLogStr (style Bold $ color Yellow "[ Warn ]")
|
LevelWarn -> toLogStr (style' "[ Warn ]")
|
||||||
LevelError -> toLogStr (style Bold $ color Red "[ Error ]")
|
LevelError -> toLogStr (style' "[ Error ]")
|
||||||
LevelOther t -> toLogStr "[ " <> toLogStr t <> toLogStr " ]"
|
LevelOther t -> toLogStr "[ " <> toLogStr t <> toLogStr " ]"
|
||||||
let out = fromLogStr (l <> toLogStr " " <> str' <> toLogStr "\n")
|
let strs = fmap toLogStr . B.split (fromIntegral $ ord '\n') . fromLogStr $ str'
|
||||||
|
let out = case strs of
|
||||||
|
[] -> B.empty
|
||||||
|
(x:xs) -> fromLogStr
|
||||||
|
. foldr (\a b -> a <> toLogStr "\n" <> b) mempty
|
||||||
|
. ((l <> toLogStr " " <> x) :)
|
||||||
|
. fmap (\line' -> toLogStr (style' "[ ... ] ") <> line' )
|
||||||
|
$ xs
|
||||||
|
|
||||||
when (lcPrintDebug || (not lcPrintDebug && (level /= LevelDebug)))
|
when (lcPrintDebug || (not lcPrintDebug && (level /= LevelDebug)))
|
||||||
$ colorOutter out
|
$ colorOutter out
|
||||||
|
|
||||||
-- raw output
|
-- raw output
|
||||||
let lr = case level of
|
let lr = case level of
|
||||||
LevelDebug -> toLogStr "Debug: "
|
LevelDebug -> toLogStr "Debug:"
|
||||||
LevelInfo -> toLogStr "Info:"
|
LevelInfo -> toLogStr "Info:"
|
||||||
LevelWarn -> toLogStr "Warn:"
|
LevelWarn -> toLogStr "Warn:"
|
||||||
LevelError -> toLogStr "Error:"
|
LevelError -> toLogStr "Error:"
|
||||||
|
|||||||
@@ -190,14 +190,14 @@ hideError :: (MonadIO m, MonadCatch m) => IOErrorType -> m () -> m ()
|
|||||||
hideError err = handleIO (\e -> if err == ioeGetErrorType e then pure () else liftIO . ioError $ e)
|
hideError err = handleIO (\e -> if err == ioeGetErrorType e then pure () else liftIO . ioError $ e)
|
||||||
|
|
||||||
|
|
||||||
hideErrorDef :: [IOErrorType] -> a -> IO a -> IO a
|
hideErrorDef :: (MonadIO m, MonadCatch m) => [IOErrorType] -> a -> m a -> m a
|
||||||
hideErrorDef errs def =
|
hideErrorDef errs def =
|
||||||
handleIO (\e -> if ioeGetErrorType e `elem` errs then pure def else ioError e)
|
handleIO (\e -> if ioeGetErrorType e `elem` errs then pure def else liftIO $ ioError e)
|
||||||
|
|
||||||
|
|
||||||
hideErrorDefM :: [IOErrorType] -> IO a -> IO a -> IO a
|
hideErrorDefM :: (MonadIO m, MonadCatch m) => [IOErrorType] -> m a -> m a -> m a
|
||||||
hideErrorDefM errs def =
|
hideErrorDefM errs def =
|
||||||
handleIO (\e -> if ioeGetErrorType e `elem` errs then def else ioError e)
|
handleIO (\e -> if ioeGetErrorType e `elem` errs then def else liftIO $ ioError e)
|
||||||
|
|
||||||
|
|
||||||
-- TODO: does this work?
|
-- TODO: does this work?
|
||||||
@@ -334,37 +334,38 @@ copyDirectoryRecursive srcDir destDir = do
|
|||||||
in doCopy src dest
|
in doCopy src dest
|
||||||
| (srcBase, srcFile) <- srcFiles ]
|
| (srcBase, srcFile) <- srcFiles ]
|
||||||
|
|
||||||
-- | List all the files in a directory and all subdirectories.
|
|
||||||
--
|
-- | List all the files in a directory and all subdirectories.
|
||||||
-- The order places files in sub-directories after all the files in their
|
--
|
||||||
-- parent directories. The list is generated lazily so is not well defined if
|
-- The order places files in sub-directories after all the files in their
|
||||||
-- the source directory structure changes before the list is used.
|
-- parent directories. The list is generated lazily so is not well defined if
|
||||||
--
|
-- the source directory structure changes before the list is used.
|
||||||
getDirectoryContentsRecursive :: FilePath -> IO [FilePath]
|
--
|
||||||
getDirectoryContentsRecursive topdir = recurseDirectories [""]
|
getDirectoryContentsRecursive :: FilePath -> IO [FilePath]
|
||||||
|
getDirectoryContentsRecursive topdir = recurseDirectories [""]
|
||||||
|
where
|
||||||
|
recurseDirectories :: [FilePath] -> IO [FilePath]
|
||||||
|
recurseDirectories [] = return []
|
||||||
|
recurseDirectories (dir:dirs) = unsafeInterleaveIO $ do
|
||||||
|
(files, dirs') <- collect [] [] =<< getDirectoryContents (topdir </> dir)
|
||||||
|
files' <- recurseDirectories (dirs' ++ dirs)
|
||||||
|
return (files ++ files')
|
||||||
|
|
||||||
where
|
where
|
||||||
recurseDirectories :: [FilePath] -> IO [FilePath]
|
collect files dirs' [] = return (reverse files
|
||||||
recurseDirectories [] = return []
|
,reverse dirs')
|
||||||
recurseDirectories (dir:dirs) = unsafeInterleaveIO $ do
|
collect files dirs' (entry:entries) | ignore entry
|
||||||
(files, dirs') <- collect [] [] =<< getDirectoryContents (topdir </> dir)
|
= collect files dirs' entries
|
||||||
files' <- recurseDirectories (dirs' ++ dirs)
|
collect files dirs' (entry:entries) = do
|
||||||
return (files ++ files')
|
let dirEntry = dir </> entry
|
||||||
|
isDirectory <- doesDirectoryExist (topdir </> dirEntry)
|
||||||
|
if isDirectory
|
||||||
|
then collect files (dirEntry:dirs') entries
|
||||||
|
else collect (dirEntry:files) dirs' entries
|
||||||
|
|
||||||
where
|
ignore ['.'] = True
|
||||||
collect files dirs' [] = return (reverse files
|
ignore ['.', '.'] = True
|
||||||
,reverse dirs')
|
ignore _ = False
|
||||||
collect files dirs' (entry:entries) | ignore entry
|
|
||||||
= collect files dirs' entries
|
|
||||||
collect files dirs' (entry:entries) = do
|
|
||||||
let dirEntry = dir </> entry
|
|
||||||
isDirectory <- doesDirectoryExist (topdir </> dirEntry)
|
|
||||||
if isDirectory
|
|
||||||
then collect files (dirEntry:dirs') entries
|
|
||||||
else collect (dirEntry:files) dirs' entries
|
|
||||||
|
|
||||||
ignore ['.'] = True
|
|
||||||
ignore ['.', '.'] = True
|
|
||||||
ignore _ = False
|
|
||||||
|
|
||||||
-- https://github.com/haskell/directory/issues/110
|
-- https://github.com/haskell/directory/issues/110
|
||||||
-- https://github.com/haskell/directory/issues/96
|
-- https://github.com/haskell/directory/issues/96
|
||||||
|
|||||||
@@ -132,13 +132,17 @@ hr {
|
|||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#platform-instructions-linux > div > pre,
|
span.code {
|
||||||
#platform-instructions-mac > div > pre,
|
font-family: 'Lucida Console', monospace;
|
||||||
#platform-instructions-freebsd > div > pre,
|
}
|
||||||
#platform-instructions-win32 > div > pre,
|
|
||||||
#platform-instructions-win64 > div > pre,
|
#platform-instructions-linux div > pre,
|
||||||
#platform-instructions-default > div > div > pre,
|
#platform-instructions-mac div > pre,
|
||||||
#platform-instructions-unknown > div > div > pre {
|
#platform-instructions-freebsd div > pre,
|
||||||
|
#platform-instructions-win32 div > pre,
|
||||||
|
#platform-instructions-win64 div > pre,
|
||||||
|
#platform-instructions-default div > div > pre,
|
||||||
|
#platform-instructions-unknown div > div > pre {
|
||||||
background-color: #515151;
|
background-color: #515151;
|
||||||
color: white;
|
color: white;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
|||||||
@@ -44,23 +44,40 @@
|
|||||||
<div id="platform-instructions-win32" class="instructions">
|
<div id="platform-instructions-win32" class="instructions">
|
||||||
<p>
|
<p>
|
||||||
To install Haskell,<br/>run the following in a powershell session (as a non-admin user).
|
To install Haskell,<br/>run the following in a powershell session (as a non-admin user).
|
||||||
<div class="command-button"><pre><span class='ghcup-command' id="ghcup-command-powershell">Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-WebRequest -UseBasicParsing https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 | Invoke-Expression</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div>
|
||||||
|
<div class="command-button"><pre><span class='ghcup-command' id="ghcup-command-powershell">Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="other-help">If you want to run an interactive installation, change <span class='code'>$false</span> to <span class='code'>$true</span> at the end of the script.</p>
|
||||||
|
</div>
|
||||||
<p>If you're a Windows Subsystem 2 for Linux user run the following in your terminal, then follow the onscreen instructions to install Haskell.
|
<p>If you're a Windows Subsystem 2 for Linux user run the following in your terminal, then follow the onscreen instructions to install Haskell.
|
||||||
</p>
|
</p>
|
||||||
<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div>
|
||||||
|
<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="other-help">WSL1 does not work with ghcup, follow <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">the instructions here</a> to upgrade to WSL2 if needed.</p>
|
||||||
|
</div>
|
||||||
</p>
|
</p>
|
||||||
<p class="other-help">WSL1 does not work with ghcup, follow <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">the instructions here</a> to upgrade to WSL2 if needed.</br>You appear to be running Windows 32-bit. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
|
<hr/>
|
||||||
|
<p class="other-help">You appear to be running Windows 32-bit. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="platform-instructions-win64" class="instructions" style="display: none;">
|
<div id="platform-instructions-win64" class="instructions" style="display: none;">
|
||||||
<p>
|
<p>
|
||||||
To install Haskell,<br/>run the following in a powershell session (as a non-admin user).
|
To install Haskell,<br/>run the following in a powershell session (as a non-admin user).
|
||||||
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-WebRequest -UseBasicParsing https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 | Invoke-Expression</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div>
|
||||||
|
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="other-help">If you want to run an interactive installation, change <span class='code'>$false</span> to <span class='code'>$true</span> at the end of the script.</p>
|
||||||
|
</div>
|
||||||
</p>
|
</p>
|
||||||
<p>If you're a Windows Subsystem 2 for Linux user run the following in your terminal, then follow the onscreen instructions to install Haskell.
|
<p>If you're a Windows Subsystem 2 for Linux user run the following in your terminal, then follow the onscreen instructions to install Haskell.
|
||||||
</p>
|
</p>
|
||||||
<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div>
|
||||||
<p class="other-help">WSL1 does not work with ghcup, follow <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">the instructions here</a> to upgrade to WSL2 if needed.</br>You appear to be running Windows 64-bit. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
|
<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="other-help">WSL1 does not work with ghcup, follow <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">the instructions here</a> to upgrade to WSL2 if needed.</p>
|
||||||
|
</div>
|
||||||
|
<p class="other-help">You appear to be running Windows 64-bit. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="platform-instructions-unknown" class="instructions" style="display: none;">
|
<div id="platform-instructions-unknown" class="instructions" style="display: none;">
|
||||||
@@ -92,7 +109,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
If you are running Windows,<br/>run the following in a powershell session (as a non-admin user).
|
If you are running Windows,<br/>run the following in a powershell session (as a non-admin user).
|
||||||
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-WebRequest -UseBasicParsing https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 | Invoke-Expression</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -111,7 +128,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
If you are running Windows,<br/>run the following in a powershell session (as a non-admin user).
|
If you are running Windows,<br/>run the following in a powershell session (as a non-admin user).
|
||||||
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-WebRequest -UseBasicParsing https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 | Invoke-Expression</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
<div class="command-button"><pre><span class='ghcup-command'>Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false</span></span></pre><button class="tooltip" onclick="copyToClipboardPowershell()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user