Stable API for querying flags in Setup.hs #10286
noughtmare
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a contributor to UUAGC, which is a preprocessor that generates .hs files from a custom DSL. UUAGC is self-hosted. To build it we want to be able to choose between two approaches:
To do this we used to use a CPP flag
-DEXTERNAL_UUAGC
and conditionally compiled our Setup.hs based on that:This works when compiling with stack like this:
stack build --ghc-options="-DEXTERNAL_UUAGC"
. Unfortunately, this does not work (any more?) with cabalcabal build --ghc-options="-DEXTERNAL_UUAGC"
.Now, I think this approach was very ugly. Instead it would be much nicer if we could simply use a cabal flag to toggle this behavior. I've been able to implement that:
However, I feel like this relies too much on unstable functions of the Cabal API. I believe this is already broken in the latest version of Cabal.
Could this functionality be provided by a stable API? Or is there a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions