diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-01-03 18:16:06 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-08 10:18:31 -0500 |
commit | 7d04b9f298c9cc0ff291e0717826743f488670bb (patch) | |
tree | ab1b8eaa38260db7e5d9b729fd30615ea8874c10 /hadrian | |
parent | 28b5349a1ae88872e343c58c270fe90329f14d87 (diff) | |
download | haskell-7d04b9f298c9cc0ff291e0717826743f488670bb.tar.gz |
hadrian: Allow override of Cabal configuration in hadrian.settings
Fixes #17612 by adding a `cabal.configure.opts` key for
`hadrian.settings`.
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/doc/user-settings.md | 32 | ||||
-rwxr-xr-x | hadrian/src/Settings.hs | 20 |
2 files changed, 32 insertions, 20 deletions
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md index 04a526605d..064918efe2 100644 --- a/hadrian/doc/user-settings.md +++ b/hadrian/doc/user-settings.md @@ -385,25 +385,27 @@ the right names for them: only when building the given package, or that the said options should be used when building all known packages, if the Hadrian command ever gets them to be built; -- the third slot is the builder, `ghc` or `cc`, to refer to GHC commands or - C compiler commands; -- the final slot is the builder mode, `{c, hs, link, deps, toolargs}`: +- the remaining slots specify the builder and how it was invoked, + + * `ghc` refers to GHC commands; the final slot refers to how GHC is invoked: - * `c` for commands that build C files with GHC - * `hs` for commands that compile Haskell modules with GHC - * `link` for GHC linking command - * `deps` for commands that figure out dependencies between Haskell modules - (with `ghc -M`) - * `toolargs` for GHC commands that are used to generate the right ghci - argument for `hadrian/ghci.sh` to work + * `c.opts` for commands that build C files with GHC + * `hs.opts` for commands that compile Haskell modules with GHC + * `link.opts` for GHC linking command + * `deps.opts` for commands that figure out dependencies between Haskell modules + (with `ghc -M`) + * `toolargs.opts` for GHC commands that are used to generate the right ghci + argument for `hadrian/ghci.sh` to work - for GHC and `{c, deps}`: + * `cc` refers to C compiler commands - * `c` for commands that call the C compiler on some C files - * `deps` for commands that call the C compiler for figuring out - dependencies between C files + * `c.opts` for commands that call the C compiler on some C files + * `deps.opts` for commands that call the C compiler for figuring out + dependencies between C files + + * `cabal.configure.opts` refers to Cabal configure command line. Note that + package flags can be given by adding `--flags=...` arguments. - for the C compiler; - using a wildcard (`*`) ranges over all possible values for a given "slot"; - `=` entirely overrides the arguments for a given builder in a given context, with the value specified on the right hand side of `=`, while `+=` merely diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs index 068e7ba914..b57029a967 100755 --- a/hadrian/src/Settings.hs +++ b/hadrian/src/Settings.hs @@ -226,11 +226,18 @@ builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> wildcard (pure True) stage wstg <&&> wildcard (pure True) package wpkg <&&> (case builderMode of - Left ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode - Right ccMode -> wildcard (builder Cc) (builder . Cc) ccMode)) + BM_Ghc ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode + BM_Cc ccMode -> wildcard (builder Cc) (builder . Cc) ccMode + BM_CabalConfigure -> builder (Cabal Setup) ) + ) where (<&&>) = liftA2 (&&) +-- | Which builder a setting should apply to +data BuilderMode = BM_Ghc (Wildcard GhcMode) + | BM_Cc (Wildcard CcMode) + | BM_CabalConfigure + -- | Interpretation-agnostic description of the builder settings -- supported by Hadrian. -- @@ -238,6 +245,7 @@ builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> -- -- > (<stage> or *).(<package name> or *).ghc.(<ghc mode> or *).opts -- > (<stage> or *).(<package name> or *).cc.(<cc mode> or *).opts +-- > (<stage> or *).(<package name> or *).cabal.configure.opts -- -- where: -- - @<stage>@ is one of @stage0@, @stage1@, @stage2@ or @stage3@; @@ -255,13 +263,15 @@ builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> -- apply GHC or C compiler options uniformly over all stages, packages -- and compiler modes, if we so desire, by using a wildcard in the -- appropriate spot. -builderSetting :: Match f => f (Wildcard Stage, Wildcard Package, Either (Wildcard GhcMode) (Wildcard CcMode)) +builderSetting :: Match f + => f (Wildcard Stage, Wildcard Package, BuilderMode) builderSetting = (,,) <$> wild stages <*> wild pkgs <*> matchOneOf - [ str "ghc" *> fmap Left (wild ghcBuilder) <* str "opts" - , str "cc" *> fmap Right (wild ccBuilder) <* str "opts" + [ str "ghc" *> fmap BM_Ghc (wild ghcBuilder) <* str "opts" + , str "cc" *> fmap BM_Cc (wild ccBuilder) <* str "opts" + , BM_CabalConfigure <$ str "cabal" <* str "configure" <* str "opts" ] where ghcBuilder = |