Hi Roman, On Fri, Nov 9, 2012 at 9:10 AM, Roman Cheplyaka <r...@ro-che.info> wrote: > Thanks for the suggestion. > > Is the "protocol" between Cabal and ghc described anywhere, or do I need > to read the sources for that?
No, I don't think that it's documented separately. The code is not very complicated, though - see buildLib/buildExe in Distribution.Simple.GHC. > 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. 'cabal build' is equivalent to 'runhaskell Setup.hs build' 'cabal configure' is mostly equivalent to 'runhaskell Setup.hs configure --user', but uses preferences from ~/.cabal/config. So I think that you can just ship a compiled Setup.hs with your analyser, but you will have to trick 'configure' into thinking that you have all dependencies for the packages that you're compiling installed (basically you'll have to provide a fake 'ghc-pkg' that supports the 'dump' command - with ghc installed, you can just invoke the real ghc-pkg). > I tried this, and one problem I ran into is that Cabal invokes the > linker on the files that it expects my tool to produce. 'ld' fails, and > the build aborts. So you're building a library. Looking at buildLib in Distribution.Simple.GHC I don't see a way to stop the build before the linking phase. But your tool should have already processed all the source files at this stage. Maybe you can produce some dud .o files to placate ld or just print a message that says something like "Analysis complete. Don't worry about the link failure."? -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments _______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel