gitlab-ci: Implement support for i386/Windows bindists
[ghc.git] / .gitlab / win32-init.sh
1 #!/bin/bash
2
3 set -e
4
5 toolchain=`pwd`/toolchain
6 PATH="$toolchain/bin:/mingw64/bin:$PATH"
7
8 if [ -d "`pwd`/cabal-cache" ]; then
9 cp -Rf cabal-cache $APPDATA/cabal
10 fi
11
12 if [ ! -e $toolchain/bin/ghc ]; then
13 case $MSYSTEM in
14 MINGW32)
15 triple="i386-unknown-mingw32"
16 ;;
17 MINGW64)
18 triple="x86_64-unknown-mingw32"
19 ;;
20 *)
21 echo "win32-init: Unknown MSYSTEM $MSYSTEM"
22 exit 1
23 ;;
24 esac
25 curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-$triple.tar.xz | tar -xJ
26 mv ghc-$GHC_VERSION toolchain
27 fi
28
29 if [ ! -e $toolchain/bin/cabal ]; then
30 curl https://www.haskell.org/cabal/release/cabal-install-2.2.0.0/cabal-install-2.2.0.0-i386-unknown-mingw32.zip > /tmp/cabal.zip
31 unzip /tmp/cabal.zip
32 mv cabal.exe $toolchain/bin
33 fi
34
35 if [ ! -e $toolchain/bin/happy ]; then
36 cabal update
37 cabal install happy
38 cp $APPDATA/cabal/bin/happy $toolchain/bin
39 fi
40
41 if [ ! -e $toolchain/bin/alex ]; then
42 cabal update
43 cabal install alex
44 cp $APPDATA/cabal/bin/alex $toolchain/bin
45 fi
46