Remove a stray line from cabal-install changelog
[cabal.git] / .gitlab / ci.sh
blob1515a6afe227ea460f5968b4622ad80ee6937071
1 #!/usr/bin/env bash
3 set -Eeuo pipefail
5 source "$CI_PROJECT_DIR/.gitlab/common.sh"
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"
14 export CABAL_DIR="$CI_PROJECT_DIR/cabal"
16 case "$(uname)" in
17 MSYS_*|MINGW*)
18 export CABAL_DIR="$(cygpath -w "$CABAL_DIR")"
19 EXE_EXT=".exe"
22 EXE_EXT=""
24 esac
26 mkdir -p "$CABAL_DIR"
28 # https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
29 # and
30 # https://github.com/haskellari/lukko/issues/17
32 # $PLATFORM comes from CI.
33 if [ "$(getconf LONG_BIT)" = "32" -o "${PLATFORM:=xxx}" = "x86_64-linux-centos7" ] ; then
34 echo 'constraints: lukko -ofd-locking' >> cabal.release.project.local
37 # In February 2024, cabal started using zlib-0.7.0.0, which uses pkg-config by
38 # default. The GitLab CI environment doesn't (yet) supply pkg-config, and zlib
39 # does just fine without it on modern GHCs. That said, the CI environment
40 # probably *should* have pkg-config installed. See
41 # https://github.com/haskell/cabal/issues/9774.
42 echo 'constraints: zlib -pkg-config' >> cabal.release.project.local
43 # Furthermore, on Windows, zlib claims that libz is shipped with GHC, so it just
44 # uses @extra-libraries: z@ if pkg-config is False. If you are reading this
45 # comment, however, this didn't work. Thus we switch to using the bundled libz,
46 # as was done in zlib <0.7.0.0.
47 case "$(uname)" in
48 MSYS_*|MINGW*)
49 echo 'constraints: zlib +bundled-c-zlib' >> cabal.release.project.local
51 esac
53 args=(
54 --disable-profiling
55 --enable-executable-stripping
56 --project-file=cabal.release.project
57 ${ADD_CABAL_ARGS}
60 run cabal update hackage.haskell.org,HEAD
61 run cabal v2-build ${args[@]} cabal-install
63 mkdir "$CI_PROJECT_DIR/out"
64 cp "$(cabal list-bin ${args[@]} cabal-install:exe:cabal)" "$CI_PROJECT_DIR/out/cabal$EXE_EXT"
65 cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json"
66 cd "$CI_PROJECT_DIR/out/"
68 # create tarball/zip
69 TARBALL_PREFIX="cabal-install-$("$CI_PROJECT_DIR/out/cabal" --numeric-version)"
70 case "${TARBALL_EXT}" in
71 zip)
72 zip "${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" "cabal${EXE_EXT}" plan.json
74 tar.xz)
75 tar caf "${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" "cabal${EXE_EXT}" plan.json
78 fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
80 esac
82 rm cabal plan.json