summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-26 13:41:24 -0400
committerBen Gamari <ben@well-typed.com>2019-10-22 20:30:20 -0400
commit54d306a1ff7e6a9e097d0b3b02d0f7d9b657afdf (patch)
tree9b4020b3b0849cbe6d71d997169f99fc29a691a1
parent2d2cc76ffb781d01c800608cd8be05cca67ac4c0 (diff)
downloadhaskell-wip/T16873.tar.gz
hadrian: Warn user if hadrian build fails due to lack of threaded RTSwip/T16873
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