urbit/sh/travis-install-stack

46 lines
765 B
Plaintext
Raw Normal View History

2019-12-11 10:39:52 +03:00
#!/usr/bin/env bash
set -ex
2019-12-12 06:59:45 +03:00
##
## Make sure this is running OSX/Linux in Travis
##
os="$TRAVIS_OS_NAME"
[ "$os" = osx ] || [ "$os" = linux ]
##
## Download the stack executable.
##
mkdir -p ~/.local/bin
2019-12-11 10:39:52 +03:00
2019-12-12 06:59:45 +03:00
stackurl="https://get.haskellstack.org/stable/$os-x86_64.tar.gz"
2019-12-11 10:39:52 +03:00
2019-12-12 06:59:45 +03:00
case $os in
osx)
curl -L "$stackurl" |
tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
2019-12-12 07:11:51 +03:00
;;
2019-12-12 06:59:45 +03:00
linux)
mkdir -p tmp
curl -L "$stackurl" | tar xz -C tmp
mv tmp/stack-*/stack ~/.local/bin
2019-12-12 07:11:51 +03:00
;;
2019-12-12 06:59:45 +03:00
esac
2019-12-11 10:39:52 +03:00
2019-12-12 06:59:45 +03:00
##
## Use the more reliable S3 mirror of Hackage.
##
2019-12-11 10:39:52 +03:00
mkdir -p ~/.cabal
cat > ~/.cabal/config <<EOF
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
remote-repo-cache: $HOME/.cabal/packages
EOF