summaryrefslogtreecommitdiff
path: root/.gitlab/win32-init.sh
blob: aec73ce0833ed93ba720e62c05b9d8e2892e1b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

set -e

toolchain=`pwd`/toolchain
PATH="$toolchain/bin:/mingw64/bin:$PATH"

if [ -d "`pwd`/cabal-cache" ]; then
    cp -Rf cabal-cache $APPDATA/cabal
fi

if [ ! -e $toolchain/bin/ghc ]; then
    case $MSYSTEM in
      MINGW32)
        triple="i386-unknown-mingw32"
        ;;
      MINGW64)
        triple="x86_64-unknown-mingw32"
        ;;
      *)
        echo "win32-init: Unknown MSYSTEM $MSYSTEM"
        exit 1
        ;;
    esac
    curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-$triple.tar.xz | tar -xJ
    mv ghc-$GHC_VERSION toolchain
fi

if [ ! -e $toolchain/bin/cabal ]; then
    url="https://downloads.haskell.org/~cabal/cabal-install-2.4.1.0/cabal-install-2.4.1.0-x86_64-unknown-mingw32.zip"
    curl $url > /tmp/cabal.zip
    unzip /tmp/cabal.zip
    mv cabal.exe $toolchain/bin
fi

if [ ! -e $toolchain/bin/happy ]; then
    cabal update
    cabal install happy
    cp $APPDATA/cabal/bin/happy $toolchain/bin
fi

if [ ! -e $toolchain/bin/alex ]; then
    cabal update
    cabal install alex
    cp $APPDATA/cabal/bin/alex $toolchain/bin
fi