
* Henning Thielemann
Am 28.02.2014 23:00, schrieb Roman Cheplyaka:
* Henning Thielemann
[2014-02-28 22:48:59+0100] Nice! Is there a recommended way to transfer CPP options from the Cabal file to the CpphsOptions record?
Yes, haskell-packages[2] lets you easily create a cabal-integrated "compiler". See the compile method[3] in particular.
For an example of how this all glues together, see [4].
[2]: http://hackage.haskell.org/package/haskell-packages [3]: http://hackage.haskell.org/package/haskell-packages-0.2.3.4/docs/Distributio... [4]: https://github.com/haskell-suite/haskell-names/blob/master/hs-gen-iface/src/...
Treating check-pvp as compiler driven by Cabal sounds reasonable, since this would do all the preprocessing stuff and would also work on tarballs etc. However the haskell-name framework seems to expect a binary executable as compiler. According to
http://documentup.com/haskell-suite/haskell-names
I would have to design the checker as a tool that only reads modules, not the package description, called maybe 'check-modules-pvp' and then run
$ cabal install --haskell-suite -w check-modules-pvp mypkg
My problem is: The checker needs to read the package description in order to classify the dependency ranges. The compiler has no access to the package description.
Right, — similar to how ghc doesn't access package description either. I guess there's no reason not to add such a feature, if you're willing to write a patch (to both haskell-packages and Cabal).
If it tries to load the package description manually, that will fail on tarballs.
Not sure what you mean here. What tarballs?
I can also not see how I define my own command line options in the Compiler interface.
Good point. I've added 'customMain' to git repo. Let me know if it works for you. Roman