Sdist -> bindist -> tests
[ghc.git] / .circleci / prepare-system.sh
1 #!/usr/bin/env bash
2 # vim: sw=2 et
3 set -euo pipefail
4
5 fail() {
6 echo "ERROR: $*" >&2
7 exit 1
8 }
9
10 case "$(uname)" in
11 Linux)
12 if [[ -n ${TARGET:-} ]]; then
13 if [[ $TARGET = FreeBSD ]]; then
14 # cross-compiling to FreeBSD
15 add-apt-repository -y ppa:hvr/ghc
16 apt-get update -qq
17 apt-get install -qy \
18 ghc-8.0.2 cabal-install alex happy ncurses-dev git \
19 openssh-client make automake autoconf gcc perl \
20 python3 texinfo xz-utils xutils-dev curl
21 cabal update
22 cabal install --reinstall hscolour
23 ln -s $HOME/.cabal/bin/HsColour /usr/local/bin/HsColour
24 else
25 fail "TARGET=$target not supported"
26 fi
27 else
28 # assuming Ubuntu
29 apt-get update -qq
30 apt-get install -qy \
31 git openssh-client make automake autoconf gcc perl python3 \
32 texinfo xz-utils xutils-dev curl
33 cabal update
34 cabal install --reinstall hscolour
35 fi
36 ;;
37 Darwin)
38 if [[ -n ${TARGET:-} ]]; then
39 fail "uname=$(uname) not supported for cross-compilation"
40 fi
41 brew install ghc cabal-install python3 ncurses
42 cabal update
43 cabal install --reinstall alex happy haddock hscolour
44 # put them on the $PATH, don't fail if already installed
45 ln -s $HOME/.cabal/bin/alex /usr/local/bin/alex || true
46 ln -s $HOME/.cabal/bin/happy /usr/local/bin/happy || true
47 ln -s $HOME/.cabal/bin/hscolour /usr/local/bin/hscolour || true
48 ;;
49 *)
50 fail "uname=$(uname) not supported"
51 esac