Cabal and c2hs
dominic.steinitz at blueyonder.co.uk
Sat Apr 30 13:22:40 EDT 2005
On Saturday 30 Apr 2005 4:17 pm, Isaac Jones wrote:
> 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.
> > 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:
> 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.
Thanks for your prompt response. I did have a look at these references before
I posted and didn't find them very enlightening. I've now looked at the
sources and come up with this which works. Is this the right way to do it?
BTW I discovered a bug in the .chs handler. You have "-o " rather than "-o". I
can try and send a patch but it might be easier if you edit the file
[("chs", \_ _ -> myPpC2hs)]
myPpC2hs inFile outFile verbose
= rawSystemPath verbose "c2hs" ["-o" ++ outFile, "ip_icmp.h", inFile]
More information about the Libraries