ghcup-hs/.gitlab/script/ghcup_release.sh

49 lines
1.3 KiB
Bash
Raw Normal View History

2020-04-19 15:00:05 +00:00
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup_env"
mkdir -p "$CI_PROJECT_DIR"/.local/bin
ecabal() {
2021-05-14 21:09:45 +00:00
cabal "$@"
2020-04-19 15:00:05 +00:00
}
git describe
2020-04-19 15:00:05 +00:00
# build
ecabal update
2021-04-11 17:12:55 +00:00
(
cd /tmp
ecabal install -w ghc-${GHC_VERSION} --installdir="$CI_PROJECT_DIR"/.local/bin hspec-discover
)
2020-04-19 15:00:05 +00:00
if [ "${OS}" = "LINUX" ] ; then
2021-02-24 14:19:29 +00:00
if [ "${ARCH}" = "32" ] ; then
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui -ftar
2021-02-24 14:19:29 +00:00
elif [ "${ARCH}" = "64" ] ; then
2020-07-06 20:39:16 +00:00
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui
2021-02-24 14:19:29 +00:00
else
ecabal build -w ghc-${GHC_VERSION} -ftui
2020-07-06 20:39:16 +00:00
fi
2020-04-27 14:23:44 +00:00
elif [ "${OS}" = "FREEBSD" ] ; then
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections' --constraint="zlib +bundled-c-zlib" --constraint="zip +disable-zstd" -ftui
2021-05-14 21:09:45 +00:00
elif [ "${OS}" = "WINDOWS" ] ; then
ecabal build -w ghc-${GHC_VERSION} --constraint="zlib +bundled-c-zlib" --constraint="lzma +static"
2020-04-19 15:00:05 +00:00
else
2021-03-07 18:46:44 +00:00
ecabal build -w ghc-${GHC_VERSION} --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" -ftui
2020-04-19 15:00:05 +00:00
fi
mkdir out
2021-06-10 13:39:50 +00:00
binary=$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')
ver=$("${binary}" --numeric-version)
2020-07-06 20:39:16 +00:00
if [ "${OS}" = "DARWIN" ] ; then
2021-06-10 13:39:50 +00:00
strip "${binary}"
2020-07-06 20:39:16 +00:00
else
2021-06-10 13:39:50 +00:00
strip -s "${binary}"
2020-07-06 20:39:16 +00:00
fi
2021-06-10 13:39:50 +00:00
cp "${binary}" out/${ARTIFACT}-${ver}
2020-04-19 15:00:05 +00:00