summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-26 13:41:24 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-24 08:45:41 -0400
commit83655b06e6d3e93b2d15bb0fa250fbb113d7fe68 (patch)
tree2bda09882115c16bd981870ecbeb9285addc0d70
parent7f72b540288bbdb32a6750dd64b9d366501ed10c (diff)
downloadhaskell-83655b06e6d3e93b2d15bb0fa250fbb113d7fe68.tar.gz
hadrian: Warn user if hadrian build fails due to lack of threaded RTS
See #16873.
-rwxr-xr-xhadrian/build.cabal.sh16
-rw-r--r--hadrian/hadrian.cabal12
2 files changed, 27 insertions, 1 deletions
diff --git a/hadrian/build.cabal.sh b/hadrian/build.cabal.sh
index 55ae958e9a..06dcb43ba2 100755
--- a/hadrian/build.cabal.sh
+++ b/hadrian/build.cabal.sh
@@ -21,13 +21,27 @@ fi
CABVERSTR=$("$CABAL" --numeric-version)
CABVER=( ${CABVERSTR//./ } )
+build_failed() {
+ ( ghc --info | grep -s '("Support SMP","YES")' ) \
+ || 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
# 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 -- \
--directory "$PWD" \
- "$@"
+ "$@" \
+ || build_failed
else
echo "Cabal version is too old; you need at least cabal-install 2.2"
exit 2
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
index 818114a4d4..013896e887 100644
--- a/hadrian/hadrian.cabal
+++ b/hadrian/hadrian.cabal
@@ -14,6 +14,15 @@ source-repository head
type: git
location: https://gitlab.haskell.org/ghc/ghc
+-- To accomodate #16873
+flag threaded
+ manual: True
+ default: True
+ description: Build with the threaded runtime for improved
+ performance. Users with bootstrap compilers
+ which don't support the threaded runtime should
+ disable this flag.
+
executable hadrian
main-is: Main.hs
hs-source-dirs: .
@@ -142,6 +151,9 @@ executable hadrian
-Wredundant-constraints
-fno-warn-name-shadowing
-rtsopts
+
+ if flag(threaded)
+ ghc-options:
-- * -I0: Disable idle GC to avoid redundant GCs while
-- waiting for external processes
-- * -qg: Don't use parallel GC as the synchronization