Skip to content

Commit 6b6c684

Browse files
chreekatMikolaj
authored andcommitted
Only use ghcup where needed
1 parent 3792f65 commit 6b6c684

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed

.gitlab/ci.sh

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,26 @@ set -Eeuo pipefail
44

55
source "$CI_PROJECT_DIR/.gitlab/common.sh"
66

7-
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain"
7+
if [[ "$(uname)" == "Linux" ]]; then
8+
export PATH="/opt/ghc/${GHC_VERSION}/bin:${PATH}"
9+
# Not all runners use ci-images, so ghcup is used.
10+
else
11+
. "$CI_PROJECT_DIR/.gitlab/ghcup.sh"
12+
fi
13+
814
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
915

1016
case "$(uname)" in
1117
MSYS_*|MINGW*)
1218
export CABAL_DIR="$(cygpath -w "$CABAL_DIR")"
13-
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
1419
EXE_EXT=".exe"
1520
;;
1621
*)
17-
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
1822
EXE_EXT=""
1923
;;
2024
esac
2125

2226
mkdir -p "$CABAL_DIR"
23-
mkdir -p "$GHCUP_BINDIR"
24-
export PATH="$GHCUP_BINDIR:$PATH"
25-
26-
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
27-
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
28-
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
29-
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
30-
# We don't use stack, and it isn't available on i386-deb9
31-
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes
32-
33-
# for some reason the subshell doesn't pick up the arm64 environment on darwin
34-
# and starts installing x86_64 GHC
35-
case "$(uname -s)" in
36-
"Darwin"|"darwin")
37-
case "$(/usr/bin/arch)" in
38-
aarch64|arm64|armv8l)
39-
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash
40-
;;
41-
*)
42-
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
43-
;;
44-
esac
45-
;;
46-
*)
47-
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
48-
;;
49-
esac
5027

5128
# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
5229
# and
@@ -74,7 +51,6 @@ case "$(uname)" in
7451
esac
7552

7653
args=(
77-
-w "ghc-$GHC_VERSION"
7854
--disable-profiling
7955
--enable-executable-stripping
8056
--project-file=cabal.project.release

.gitlab/ghcup.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain"
2+
3+
case "$(uname)" in
4+
MSYS_*|MINGW*)
5+
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
6+
;;
7+
*)
8+
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
9+
;;
10+
esac
11+
12+
mkdir -p "$GHCUP_BINDIR"
13+
export PATH="$GHCUP_BINDIR:$PATH"
14+
15+
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
16+
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
17+
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
18+
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
19+
# We don't use stack, and it isn't available on i386-deb9
20+
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes
21+
22+
# for some reason the subshell doesn't pick up the arm64 environment on darwin
23+
# and starts installing x86_64 GHC
24+
case "$(uname -s)" in
25+
"Darwin"|"darwin")
26+
case "$(/usr/bin/arch)" in
27+
aarch64|arm64|armv8l)
28+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash
29+
;;
30+
*)
31+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
32+
;;
33+
esac
34+
;;
35+
*)
36+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
37+
;;
38+
esac

0 commit comments

Comments
 (0)