diff options
Diffstat (limited to '.gitlab')
-rwxr-xr-x | .gitlab/ci.sh | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 5a42709c24..4b37a00b83 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -152,22 +152,26 @@ function show_tool() { function set_toolchain_paths() { needs_toolchain=1 case "$(uname)" in - Linux) needs_toolchain="" ;; + Linux) needs_toolchain="0" ;; *) ;; esac - if [[ -n "$needs_toolchain" ]]; then + if [[ "$needs_toolchain" = 1 ]]; then # These are populated by setup_toolchain GHC="$toolchain/bin/ghc$exe" CABAL="$toolchain/bin/cabal$exe" HAPPY="$toolchain/bin/happy$exe" ALEX="$toolchain/bin/alex$exe" else - GHC="$(which ghc)" - CABAL="/usr/local/bin/cabal" - HAPPY="$HOME/.cabal/bin/happy" - ALEX="$HOME/.cabal/bin/alex" + # These are generally set by the Docker image but + # we provide these handy fallbacks in case the + # script isn't run from within a GHC CI docker image. + if [ -z "$GHC" ]; then GHC="$(which ghc)"; fi + if [ -z "$CABAL" ]; then GHC="$(which cabal)"; fi + if [ -z "$HAPPY" ]; then GHC="$(which happy)"; fi + if [ -z "$ALEX" ]; then GHC="$(which alex)"; fi fi + export GHC export CABAL export HAPPY @@ -204,12 +208,12 @@ function setup() { } function fetch_ghc() { - local v="$GHC_VERSION" - if [[ -z "$v" ]]; then - fail "GHC_VERSION is not set" - fi - if [ ! -e "$GHC" ]; then + local v="$GHC_VERSION" + if [[ -z "$v" ]]; then + fail "neither GHC nor GHC_VERSION are not set" + fi + start_section "fetch GHC" url="https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-${boot_triple}.tar.xz" info "Fetching GHC binary distribution from $url..." @@ -233,12 +237,12 @@ function fetch_ghc() { } function fetch_cabal() { - local v="$CABAL_INSTALL_VERSION" - if [[ -z "$v" ]]; then - fail "CABAL_INSTALL_VERSION is not set" - fi - if [ ! -e "$CABAL" ]; then + local v="$CABAL_INSTALL_VERSION" + if [[ -z "$v" ]]; then + fail "neither CABAL nor CABAL_INSTALL_VERSION are not set" + fi + start_section "fetch GHC" case "$(uname)" in # N.B. Windows uses zip whereas all others use .tar.xz @@ -279,7 +283,11 @@ function fetch_cabal() { function setup_toolchain() { fetch_ghc fetch_cabal - cabal_install="$CABAL v2-install --index-state=$hackage_index_state --installdir=$toolchain/bin" + + cabal_install="$CABAL v2-install \ + --with-compiler=$GHC \ + --index-state=$hackage_index_state --installdir=$toolchain/bin" + # Avoid symlinks on Windows case "$(uname)" in MSYS_*|MINGW*) cabal_install="$cabal_install --install-method=copy" ;; |