-
-
Notifications
You must be signed in to change notification settings - Fork 369
/
ci.sh
executable file
·80 lines (64 loc) · 2.17 KB
/
ci.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -Eeuxo pipefail
source "$CI_PROJECT_DIR/.gitlab/common.sh"
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain"
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
case "$(uname)" in
MSYS_*|MINGW*)
export CABAL_DIR="$(cygpath -w "$CABAL_DIR")"
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
;;
*)
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
;;
esac
mkdir -p "$CABAL_DIR"
mkdir -p "$GHCUP_BINDIR"
export PATH="$GHCUP_BINDIR:$PATH"
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION="$GHC_VERSION"
export BOOTSTRAP_HASKELL_CABAL_VERSION="$CABAL_INSTALL_VERSION"
export BOOTSTRAP_HASKELL_VERBOSE=1
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
# for some reason the subshell doesn't pick up the arm64 environment on darwin
# and starts installing x86_64 GHC
case "$(uname -s)" in
"Darwin"|"darwin")
case "$(/usr/bin/arch)" in
aarch64|arm64|armv8l)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac
# some alpines need workaround
if ghc --info | grep -q integer-simple ; then
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi
# Shorten binary names
sed -i.bak -e 's/haskell-language-server/hls/g' \
-e 's/haskell_language_server/hls/g' \
haskell-language-server.cabal cabal.project
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
src/**/*.hs exe/*.hs
args=(
-O2
-w "ghc-$GHC_VERSION"
--project-file "$CABAL_PROJECT"
--disable-profiling
--disable-tests
--enable-executable-stripping
${ADD_CABAL_ARGS}
)
run cabal v2-build ${args[@]} exe:hls exe:hls-wrapper
mkdir "$CI_PROJECT_DIR/out"
cp "$(cabal list-bin ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/haskell-language-server-${GHC_VERSION}"
cp "$(cabal list-bin ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/haskell-language-server-wrapper"
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json"
cd "$CI_PROJECT_DIR/out/"