darcs patch: added cppOptions and c2hsOptions

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Apr 20 06:17:21 EDT 2007

Hia Vivian,

Ok, I think the right thing to do here is to change cabal and c2hs
slightly, but not to add any new fields. I think we can make it all do
the right thing without having to manually pass extra args to c2hs.

The first thing to do is to have cabal tell c2hs where to look for all
the .chi files. This depends on where we tell c2hs to put them. I think
the right place for the generated .h, .hs and .chi files is in the
dist/build directory. Then we tell ghc to look there when compiling.

I'm looking into it.


On Fri, 2007-04-20 at 18:38 +1200, Vivian McPhail wrote:
> Here is what Cabal does:
> $ ./Setup.lhs -v build
> C:\DOCUME~1\vivian\LOCALS~1\Temp\ghc139100_0\ghc139100_0.hc:8:37:
> ../src/Matlab/C/CMatrix.h: No such file or directory
> Reading parameters from
> D:\Apps\MSYS\1.0\local\src\MatlabCompiling\matlab.buildinfo
> Preprocessing library Matlab-0.0.1...
> D:\Apps\MSYS\1.0\local\bin\c2hs.exe -C -D__GLASGOW_HASKELL__=606 -C
> -Ic:\Apps\MATLAB704\bin\win32\..\..\extern\include -o
> src\Matlab\C\CMatrix.hs src\Matlab\C\CMatrix.chs
> D:\Apps\MSYS\1.0\local\bin\c2hs.exe -C -D__GLASGOW_HASKELL__=606 -C
> -Ic:\Apps\MATLAB704\bin\win32\..\..\extern\include -o src\Matlab\C\CMat.hs
> src\Matlab\C\CMat.chs
> c2hs.exe: Matlab/C/CMatrix.chi not found in:
> .

> Here is my command that works (from MatlabCompiling/test)
> $ c2hs --cppopts=-I/c/Apps/MATLAB704/extern/include --include=../src
> ../src/Matlab/C/CMatrix.chs
> Here is the addition to matlab.buildinfo which makes Cabal work:
> c2hs-options: --cppopts=-I/c/Apps/MATLAB704/bin/win32/../../extern/include
> --include=src

More information about the cabal-devel mailing list