-
Notifications
You must be signed in to change notification settings - Fork 724
Description
I was asked on #haskell to report this use case of a custom Setup.hs because apparently the Cabal developers would like to minimize such cases. My personal opinion is that my use case is so ad-hoc that there isn't much to solve in general -- but I am not an expert in Cabal at all.
I have written extensively about my use case at https://unsafeperform.io/blog/2020-05-07-integrating_verilator_and_clash_via_cabal/. Basically, depending on the value of some custom x- fields in the various Cabal components, I need to run some Haskell code (Clash's defaultMain), in a context where all Cabal dependencies are already available, in order to generate an .hsc file and an .a static library. The hsc file is then compiled the standard way, and the .a file is linked statically into the resulting exe or library.
There are at least two parts of this process that aren't directly supported by Cabal:
- Generating multiple artifacts (a static library and an
.hscfile) by one code generator / preprocessor - Multi-phase code generator pipeline: my tool generates an
.hscfile, which then needs to be further processed byhsc2hsto get the final.hsfile suitable for consumption by GHC.