2020-10-23 17:59:08 +03:00
#!/bin/bash -e -o pipefail
2020-09-10 14:34:08 +03:00
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
export PATH = " $HOME /.ghcup/bin: $PATH "
echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> " $HOME /.bashrc"
2020-10-06 14:32:37 +03:00
# ghcup output looks like this "ghc 8.6.4 base-4.12.0.0 hls-powered", need to take all the first versions only(8.6.4 in that case) and avoid pre-release ones
2020-10-06 14:30:00 +03:00
availableVersions = $( ghcup list -t ghc -r | grep -v "prerelease" | awk '{print $2}' )
2020-10-06 13:56:12 +03:00
# Install 3 latest major versions(For instance 8.6.5, 8.8.4, 8.10.2)
2020-09-10 14:34:08 +03:00
minorMajorVersions = $( echo " $availableVersions " | cut -d"." -f 1,2 | uniq | tail -n3)
for majorMinorVersion in $minorMajorVersions ; do
fullVersion = $( echo " $availableVersions " | grep " $majorMinorVersion ." | tail -n1)
echo "install ghc version $fullVersion ..."
ghcup install $fullVersion
ghcup set $fullVersion
2021-09-20 13:13:00 +03:00
# remove docs and profiling libs
2021-09-22 19:36:54 +03:00
ghc_dir = " $( ghcup whereis basedir) /ghc/ $fullVersion "
2021-09-20 13:13:00 +03:00
[ -e " ${ ghc_dir } " ] || exit 1
find " ${ ghc_dir } " \( -name "*_p.a" -o -name "*.p_hi" \) -type f -delete
rm -r " ${ ghc_dir } " /share/*
unset ghc_bin_dir ghc_dir
2020-09-10 14:34:08 +03:00
done
echo "install cabal..."
ghcup install-cabal
2020-12-23 22:14:13 +07:00
2021-01-14 00:46:44 +07:00
invoke_tests "Haskell"