5 source "$CI_PROJECT_DIR/.gitlab/common.sh"
7 export GHCUP_INSTALL_BASE_PREFIX
="$CI_PROJECT_DIR/toolchain"
8 export CABAL_DIR
="$CI_PROJECT_DIR/cabal"
12 export CABAL_DIR
="$(cygpath -w "$CABAL_DIR")"
13 GHCUP_BINDIR
="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
17 GHCUP_BINDIR
="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
23 mkdir
-p "$GHCUP_BINDIR"
24 export PATH
="$GHCUP_BINDIR:$PATH"
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
33 # for some reason the subshell doesn't pick up the arm64 environment on darwin
34 # and starts installing x86_64 GHC
37 case "$(/usr/bin/arch)" in
39 curl
--proto '=https' --tlsv1.2
-sSf https
://get-ghcup.haskell.org | arch
-arm64 /bin
/bash
42 curl
--proto '=https' --tlsv1.2
-sSf https
://get-ghcup.haskell.org | sh
47 curl
--proto '=https' --tlsv1.2
-sSf https
://get-ghcup.haskell.org | sh
51 # https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
53 # https://github.com/haskellari/lukko/issues/17
55 # $PLATFORM comes from CI.
56 if [ "$(getconf LONG_BIT)" = "32" -o "${PLATFORM:=xxx}" = "x86_64-linux-centos7" ] ; then
57 echo 'constraints: lukko -ofd-locking' >> cabal.project.release.
local
60 # In February 2024, cabal started using zlib-0.7.0.0, which uses pkg-config by
61 # default. The GitLab CI environment doesn't (yet) supply pkg-config, and zlib
62 # does just fine without it on modern GHCs. That said, the CI environment
63 # probably *should* have pkg-config installed. See
64 # https://github.com/haskell/cabal/issues/9774.
65 echo 'constraints: zlib -pkg-config' >> cabal.project.release.
local
66 # Furthermore, on Windows, zlib claims that libz is shipped with GHC, so it just
67 # uses @extra-libraries: z@ if pkg-config is False. If you are reading this
68 # comment, however, this didn't work. Thus we switch to using the bundled libz,
69 # as was done in zlib <0.7.0.0.
72 echo 'constraints: zlib +bundled-c-zlib' >> cabal.project.release.
local
79 --enable-executable-stripping
80 --project-file=cabal.project.release
84 run cabal update hackage.haskell.org
,HEAD
85 run cabal v2-build
${args[@]} cabal-install
87 mkdir
"$CI_PROJECT_DIR/out"
88 cp "$(cabal list-bin ${args[@]} cabal-install:exe:cabal)" "$CI_PROJECT_DIR/out/cabal$EXE_EXT"
89 cp dist-newstyle
/cache
/plan.json
"$CI_PROJECT_DIR/out/plan.json"
90 cd "$CI_PROJECT_DIR/out/"
93 TARBALL_PREFIX
="cabal-install-$("$CI_PROJECT_DIR/out
/cabal
" --numeric-version)"
94 case "${TARBALL_EXT}" in
96 zip "${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" "cabal${EXE_EXT}" plan.json
99 tar caf
"${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" "cabal${EXE_EXT}" plan.json
102 fail
"Unknown TARBALL_EXT: ${TARBALL_EXT}"