Cabal and c2hs

Isaac Jones ijones at syntaxpolice.org
Sat Apr 30 11:17:10 EDT 2005


Dominic Steinitz <dominic.steinitz at blueyonder.co.uk> writes:

> I've made some progress. I've installed c2hs. I'm still puzzled as to why 
> ./Setup configure didn't complain.
(snip)
> And cabal magically finds the IP_ICMP.chs file and preprocesses it. However, I 
> need to execute the following:
>
> c2hs ip_icmp.h IP_ICMP.chs
>
> not just
>
> c2hs IP_ICMP.chs
>
> How do I get cabal to do this? I saw this 
> http://www.haskell.org//pipermail/haskell/2005-April/015728.html. Does that 
> mean I need to modify cabal? Or can I use UserHooks? Are there any examples?

You can do this in a UserHook by either just calling hsc2hs on your .h
file in the preBuild phase, or you can override the c2hs preprocessor.
As I mention here:

http://www.haskell.org//pipermail/haskell/2005-April/015730.html

There's an example of using UserHooks to override a preprocessor.
Setup.lhs is the right place for the fix until we add more tags to the
.cabal file for stuff like this.

http://cvs.haskell.org/cgi-bin/cvsweb.cgi/~checkout~/fptools/libraries/Cabal/tests/withHooks/Setup.lhs?rev=1.2;content-type=text%2Fplain

peace,

  isaac


More information about the Libraries mailing list