On Sun, 2008-07-27 at 21:01 -0500, John Lato wrote:

> > Use Haskell String syntax for paths that contain spaces:
> >
> > include-dirs:  "C:\\Program Files\\program\\include"
> 
> Hi Duncan,
> 
> Thanks, this worked (mostly).  Although I had to change the line to
> 
> include-dirs: "\"C:\\Program Files\\program\\include\""
> 
> so that the path would be passed properly to cpp through c2hs.

Thanks for for filing the ticket John.

http://hackage.haskell.org/trac/hackage/ticket/316#comment:1

Turns out Cabal is doing it right and it's c2hs that we need to fix.
Shouldn't be too hard. Just need to change the way c2hs invokes cpp in
Main.hs:

    let cmd  = unwords [cpp, cppOpts, newHeaderFile, ">" ++ preprocFile]
    tracePreproc cmd
    exitCode <- liftIO $ system cmd

to something like:

    let args = cppOpts ++ [newHeaderFile]
    tracePreproc (unwords (cmd : args))
    exitCode <- liftIO $ do
      preprocHnd <- openFile WriteMode preprocFile
      process <- runProcess cpp args
                   Nothing Nothing 
                   Nothing (Just preprocHnd) Nothing
      waitForProcess process

Try that, tell me if it works and we can add the patch to the c2hs repo.


Duncan

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to