Re: [Haskell-cafe] build tools and Cabal

2008-11-26 Thread John Lato
On Tue, Nov 25, 2008 at 8:18 PM, Duncan Coutts
[EMAIL PROTECTED] wrote:
 On Tue, 2008-11-25 at 01:30 +, John Lato wrote:
 Hello,

 Cabal allows specifying arguments for tools it recognizes on the
 command line, e.g.

 runhaskell Setup.hs configure --c2hs-option=some_option

 Unfortunately, I can't find a way to make this work with .cabal (or
 .buildinfo) files, except for the specific cases of ghc, hugs, and
 nhc98 options.  Am I missing something?

 No.

 If not, could this be added easily?

 Yes, but it's not clear that we should.

 It would be very helpful as I'm trying to work around the broken cpp
 Apple provides.

 Perhaps we should do the workaround once rather than adding the
 workaround to every package.

 What is the problem exactly?


This is with c2hs on a Mac.  Using

$ cpp --version
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)
Copyright (C) 2005 Free Software Foundation, Inc.

$ c2hs -d trace
--cppopts=-I/Library/Frameworks/CsoundLib.framework/Headers
Interface.chs
Attempting to read file `Interface.chs'...
...parsing `Interface'...
...successfully loaded `Interface'.
Invoking cpp as `cpp  -x=c
-I/Library/Frameworks/CsoundLib.framework/Headers Interface.chs.h
Interface.i'...
Attempting to read file `Interface.i'...
...parsing `Interface.i'...
c2hs: Error in C header file.

/usr/include/sys/resource.h:167: (column 1) [FATAL]
   Syntax error!
  The symbol `/' does not fit here.

This error appears in other files too, at least
/usr/include/sys/signal.h.  There are also some errors caused by the
csound.h file, but I can probably get the csound maintainers to change
that.

The problem with csound.h is that it has a few #defines preceded by
whitespace, which Apple's cpp chooses to leave in the output rather
than process.

The problem with signal.h and resource.h is that they have //comments,
which cpp again chooses to retain, causing the error when Interface.i
is being parsed.

Oddly, cpp leaves the //comments in place even when called with -x=c++.

My workaround is to configure with --c2hs-option=--cpp=gcc
--c2hs-option=--cppopt=-E --c2hs-option=--cppopt=-xc.  This has the
desired behavior, but it's a lot for a user to type in.  I could make
a script to call configure with the correct options, but that sort of
system-dependent configuration seems like exactly the sort of thing
that cabal and configure are supposed to be able to work out.

So that's the problem.  I don't know if this should be addressed as a
cabal issue or a c2hs issue.  I would say that it's Apple's problem,
but that won't help moving to a solution.  I'm not even sure that
Apple's software is doing anything technical incorrect.

Regards,
John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] build tools and Cabal

2008-11-25 Thread Duncan Coutts
On Tue, 2008-11-25 at 01:30 +, John Lato wrote:
 Hello,
 
 Cabal allows specifying arguments for tools it recognizes on the
 command line, e.g.
 
 runhaskell Setup.hs configure --c2hs-option=some_option
 
 Unfortunately, I can't find a way to make this work with .cabal (or
 .buildinfo) files, except for the specific cases of ghc, hugs, and
 nhc98 options.  Am I missing something? 

No.

 If not, could this be added easily?

Yes, but it's not clear that we should.

 It would be very helpful as I'm trying to work around the broken cpp
 Apple provides.

Perhaps we should do the workaround once rather than adding the
workaround to every package.

What is the problem exactly?


Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] build tools and Cabal

2008-11-24 Thread John Lato
Hello,

Cabal allows specifying arguments for tools it recognizes on the
command line, e.g.

runhaskell Setup.hs configure --c2hs-option=some_option

Unfortunately, I can't find a way to make this work with .cabal (or
.buildinfo) files, except for the specific cases of ghc, hugs, and
nhc98 options.  Am I missing something?  If not, could this be added
easily?  It would be very helpful as I'm trying to work around the
broken cpp Apple provides.

Thanks,
John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe