summaryrefslogtreecommitdiff
path: root/hadrian/hadrian.cabal
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-07-24 11:41:11 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-26 16:26:53 -0400
commit42147534320f9ac22f16ffc226148ae553337d2e (patch)
treefcf235b7e28c24f957a79ac23ea2958dcf9ed306 /hadrian/hadrian.cabal
parent25c24535ad51aa22b9cae425c6ac4ad9a8f1e1e9 (diff)
downloadhaskell-42147534320f9ac22f16ffc226148ae553337d2e.tar.gz
hadrian: add flag disabling selftest rules which require QuickCheck
The hadrian executable depends on QuickCheck for building, meaning this library (and its dependencies) will need to be built for bootstrapping GHC in the future. Building QuickCheck, however, can require TemplateHaskell. When building a statically linking GHC toolchain, TemplateHaskell can be tricky to get to work, and cross-compiling TemplateHaskell doesn't work at all without -fexternal-interpreter, so QuickCheck introduces an element of fragility to GHC's bootstrap. Since the selftest rules are the only part of hadrian that need QuickCheck, we can easily eliminate this bootstrap dependency when required by introducing a `selftest` flag guarding the rules' inclusion. Closes #8699.
Diffstat (limited to 'hadrian/hadrian.cabal')
-rw-r--r--hadrian/hadrian.cabal15
1 files changed, 13 insertions, 2 deletions
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
index da0aa4daab..c37974914a 100644
--- a/hadrian/hadrian.cabal
+++ b/hadrian/hadrian.cabal
@@ -24,6 +24,14 @@ flag threaded
which don't support the threaded runtime should
disable this flag.
+-- See also #21913
+flag selftest
+ manual: True
+ default: True
+ description: Enables the hadrian selftest rules which require
+ QuickCheck. Disabling it thus saves on a few dependencies
+ which can be problematic when bootstrapping.
+
executable hadrian
main-is: Main.hs
hs-source-dirs: .
@@ -82,7 +90,6 @@ executable hadrian
, Rules.Program
, Rules.Register
, Rules.Rts
- , Rules.Selftest
, Rules.SimpleTargets
, Rules.SourceDist
, Rules.Test
@@ -141,7 +148,6 @@ executable hadrian
other-extensions: MultiParamTypeClasses
, TypeFamilies
build-depends: Cabal >= 3.2 && < 3.7
- , QuickCheck >= 2.6 && < 2.15
, base >= 4.8 && < 5
, bytestring >= 0.10 && < 0.12
, containers >= 0.5 && < 0.7
@@ -169,3 +175,8 @@ executable hadrian
-- time tends to eat any benefit.
"-with-rtsopts=-I0 -qg"
-threaded
+
+ if flag(selftest)
+ other-modules: Rules.Selftest
+ cpp-options: -DHADRIAN_ENABLE_SELFTEST
+ build-depends: QuickCheck >= 2.6 && < 2.15