Dominic Steinitz | 5 Jul 09:06
Picon
Favicon

Cabal and c2hs

Way back in 2005, I was able to build my haskell version of ping with
this Setup.hs

> import Distribution.Simple
> import Distribution.Simple.Utils(rawSystemPath)
> 
> main = 
>    defaultMainWithHooks 
>       defaultUserHooks {
>          hookedPreProcessors =  
>             [("chs", \_ _ -> myPpC2hs)]
>       }
> 
> myPpC2hs inFile outFile verbose
>     = rawSystemPath verbose "c2hs" ["-o", outFile, inFile]

rawSystemPath no longer seems to exist (in Distribution.Simple.Utils at
any rate).

Looking at the latest haddock, there does seem to be

> runSimplePreProcessor :: PreProcessor -> FilePath -> FilePath -> Verbosity -> IO ()

> ppC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor

but I'm struggling to see what I put in BuildInfo and LocalBuildInfo.

I presume I put "." as the FilePath?

> main = runSimplePreProcessor (ppC2hs undefined undefined) "." "." deafening

Is there some way of getting hold of the BuildInfo and LocalBuildInfo to
pass into runSimplePreProcessor?

Thanks, Dominic.

Gmane