Integrating tools with Cabal
Roman Cheplyaka
roma at ro-che.info
Fri Nov 9 09:10:14 CET 2012
Thanks for the suggestion.
Is the "protocol" between Cabal and ghc described anywhere, or do I need
to read the sources for that?
Also, is there a way to write a program that would be equivalent to
"cabal configure && cabal build" without relying on cabal-install or ghc
being installed, just by using the Cabal library? I realise that it
would only work for build-type: Simple, but it might be still useful.
* Mikhail Glushenkov <the.dead.shall.rise at gmail.com> [2012-11-09 08:57:30+0100]
> Hi,
>
> On Fri, Nov 9, 2012 at 8:06 AM, Roman Cheplyaka <roma at ro-che.info> wrote:
> > Hi,
> >
> > Suppose I have some kind of analysis tool that I want to run on a Cabal
> > project.
> >
> > The analysis tool only deals with Haskell files, so I need Cabal to
> > generate Haskell files from CPP-enabled Haskell files, .hsc files, alex
> > and happy files etc.
> >
> > I see two possible ways to do that: use Cabal as a library, or my tool
> > to be run by Cabal as a compiler.
>
> I think that the path of least resistance is to make your analysis
> tool command-line compatible with ghc. Then you can use it like this:
>
> $ cabal configure --with-compiler=/path/to/my-ghc
> $ cabal build
>
> Since 'cabal build' usually just calls 'ghc --make Main.hs', you'll
> need to do dependency chasing, but this can be implemented by parsing
> the output of 'ghc -M'.
>
> --
> () ascii ribbon campaign - against html e-mail
> /\ www.asciiribbon.org - against proprietary attachments
More information about the cabal-devel
mailing list