Commit d23fc678 authored by Stefan Schulze Frielinghaus's avatar Stefan Schulze Frielinghaus Committed by Marge Bot

hadrian: Build with threaded runtime if available

See #16873.
parent 3e884d14
Pipeline #21062 failed with stages
in 131 minutes and 18 seconds
#!/usr/bin/env bash
CABFLAGS="--disable-documentation --disable-profiling --disable-library-profiling $CABFLAGS"
CABFLAGS=("--disable-documentation" "--disable-profiling" "--disable-library-profiling" $CABFLAGS)
( ${GHC:-ghc} --info | grep -s '("Support SMP","YES")' > /dev/null ) || CABFLAGS+=("--constraint=hadrian -threaded")
# It is currently more robust to pass Cabal an absolute path to the project file.
......@@ -21,27 +22,13 @@ fi
CABVERSTR=$("$CABAL" --numeric-version)
build_failed() {
( ghc --info | grep -s '("Support SMP","YES")' > /dev/null ) \
|| cat <<EOF
Your compiler does not support the threaded runtime system.
Please disable the \`threaded\` Cabal flag in project.cabal.local
by running:
echo -e "package hadrian\n flags: -threaded" >> project.cabal.local
exit 1
if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
"$CABAL" --project-file="$PROJ" new-build $CABFLAGS -j exe:hadrian
"$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" -j exe:hadrian
# use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
"$CABAL" --project-file="$PROJ" new-exec $CABFLAGS hadrian -- \
"$CABAL" --project-file="$PROJ" new-exec "${CABFLAGS[@]}" hadrian -- \
--directory "$PWD" \
"$@" \
|| build_failed
echo "Cabal version is too old; you need at least cabal-install 2.2"
exit 2
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment