On Fri, 2007-10-19 at 11:34 +0400, Serge D. Mechveliani wrote:

> Currently, my DoCon application has the file  docon.cabal,
> with the field
> 
>   ghc-options:  <many options>
>                 ...
>                 -O
>                 +RTS -M400m -RTS
>                 -- -prof
>                 -- -auto-all
>                 
> This file defines how to build the DoCon library.
> And a DoCon user is invited to comment-out or un-comment, or change 
> any of the last 4 lines in this field definition. By this, the user 
> defines, for example, whether to compile the library with -O, with 
> -O2, or with -Onot.
> The meaning of these options is explained in the GHC documentation.

In general the users should never have to modify the .cabal file. For
the common settings that we expect the user to want to control Cabal
provides configure flags.

Ok, so you can get rid of -O and -prof and instead use:

runghc Setup.hs configure

with our without the following options:

--enable/disable-optimization           (default is enabled)
--enable/disable-library-profiling   (default is disabled)

Similarly, you do not need to use any language flags, like
-fglasgow-exts as you can use the "extensions:" field. In that field you
list the language extensions you need and Cabal knows which compiler
options those correspond to (which varies with compiler and compiler
version). This also allows you to be more precise about which language
extensions you are using.

The option -auto-all is not the default for Cabal's
--enable-library-profiling but you can make it so using:

ghc-prof-options: -auto-all

and this option will only be used when the user configures with
--enable-library-profiling

> If it also aimed to build under, say, HBC tool, then, I would probably 
> need to add the field
> 
>   hbc-options:  ...
> 
> and set there the keys according their meaning explained in the HBC 
> documentation.

The idea is that instead of having to find the options for each
implementation you might want to use, that Cabal knows the right options
for each compiler to use a feature like optimisation or profiling or
whatever.

So the only ones I think you need are:

ghc-options:
  -fno-warn-overlapping-patterns -fwarn-unused-binds 
  -fwarn-unused-matches -fwarn-unused-imports
ghc-prof-options: -auto-all
extensions: ...


Duncan
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to