Cabal and c2hs

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Sat Apr 30 07:42:23 EDT 2005


I've made some progress. I've installed c2hs. I'm still puzzled as to why 
./Setup configure didn't complain.

My cabal file is now:

Name:           Ping
Version:        0.0
License:        BSD3
Author:         Dominic Steinitz
Synopsis:       The Haskell equivalent of ping

Executable:     ping
Main-Is:        test.hs
Other-modules:  IP_ICMP

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?

Thanks, Dominic.


On Saturday 30 Apr 2005 8:38 am, Dominic Steinitz wrote:
> I am trying to migrate some old code to cabal. It uses c2hs. Now I wasn't
> sure I had c2hs installed so I ran cabal anyway.
>
> 1. Why isn't configure telling me where c2hs is? It tells me where hsc2hs
> is! 2. Why is cabal telling me it can't find a source when the source is
> present?
>
> Thanks, Dominic.
>
> Here's ping.cabal:
>
> Name:           Ping
> Version:        0.0
> License:        BSD3
> Author:         Dominic Steinitz
> Synopsis:       The Haskell equivalent of ping
>
> Executable:     ping
> Main-Is:        test.hs
> Other-modules:  IP_ICMP.chs
>
> When I run ./Setup configure, I didn't see any message saying whether c2hs
> was installed and when I run ./Setup build I get the following:
>
> [dom at tility ping]$ ./Setup build
> Preprocessing executables for Ping-0.0...
> can't find source for IP_ICMP.chs in ["."]
>
> But the source is there:
>
> [dom at tility ping]$ ls
> codes.hs  dist/        ip_icmp.h  ping.cabal   Setup*    Setup.hs  test.hs
> CVS/      IP_ICMP.chs  Makefile   ping.cabal~  Setup.hi  Setup.o



More information about the Libraries mailing list