summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2020-06-09 14:16:28 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-17 15:31:09 -0400
commitd23fc67847a27222ad8a0c193e6a10b5a4c0cf48 (patch)
treed45e0980471cf944d5dc779531d963b3ed522026
parent3e884d14102948ad49d75611da247beff25911a4 (diff)
downloadhaskell-d23fc67847a27222ad8a0c193e6a10b5a4c0cf48.tar.gz
hadrian: Build with threaded runtime if available
See #16873.
-rwxr-xr-xhadrian/build-cabal23
1 files changed, 5 insertions, 18 deletions
diff --git a/hadrian/build-cabal b/hadrian/build-cabal
index c385542410..1a35d4ca29 100755
--- a/hadrian/build-cabal
+++ b/hadrian/build-cabal
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
CABAL=cabal
-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.
PROJ="$PWD/hadrian/cabal.project"
@@ -21,27 +22,13 @@ fi
CABVERSTR=$("$CABAL" --numeric-version)
CABVER=( ${CABVERSTR//./ } )
-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
-
-EOF
- exit 1
-}
-
if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
then
- "$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
+ "$@"
else
echo "Cabal version is too old; you need at least cabal-install 2.2"
exit 2