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() {
|
|
|
|
cabal --store-dir="$(pwd)"/.store "$@"
|
|
|
|
}
|
|
|
|
|
2020-04-29 10:38:57 +00:00
|
|
|
git describe
|
|
|
|
|
2020-04-19 15:00:05 +00:00
|
|
|
# build
|
|
|
|
ecabal update
|
|
|
|
|
|
|
|
if [ "${OS}" = "LINUX" ] ; then
|
2021-02-24 14:19:29 +00:00
|
|
|
if [ "${ARCH}" = "32" ] ; then
|
2020-07-12 20:29:50 +00:00
|
|
|
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
|
2021-03-07 18:46:44 +00:00
|
|
|
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections' --constraint="zlib +bundled-c-zlib" -ftui
|
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
|
2020-04-19 17:23:54 +00:00
|
|
|
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')" .
|
2020-04-19 15:00:05 +00:00
|
|
|
ver=$(./ghcup --numeric-version)
|
2020-07-06 20:39:16 +00:00
|
|
|
if [ "${OS}" = "DARWIN" ] ; then
|
|
|
|
strip ./ghcup
|
|
|
|
else
|
|
|
|
strip -s ./ghcup
|
|
|
|
fi
|
2020-04-19 15:00:05 +00:00
|
|
|
cp ghcup out/${ARTIFACT}-${ver}
|
|
|
|
|