Configurations proposal

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Oct 25 13:56:24 EDT 2006


On Wed, 2006-10-25 at 09:39 -0500, Brian Smith wrote:

> The only way I have really wanted to use configurations so far is to
> build debug, profiling, and optimized versions of a library. In order
> to build multiple configurations, is it going to still be the case
> that I have to "configure / build / install" separately for each
> configuration? I would like to be able to say something like "
> Setup.lhs configure --optimized --debug --profiled" to build all three
> versions at once.

Cabal already lets you build both normal and profiling versions of libs
using just one "configure / build / install". Just use configure -p (or
--enable-library-profiling).

I think there should also be a configure -O flag to build using normal
optimisation flags for the current compiler (if the compiler/interpreter
supports such a notion). That would be an either/or option though, not a
both.

> Also, let's say I have this:
> 
>     Name: foo
>     Version: 1.0
>     
>     configuration: flag(DEBUG)
>     cpp-options: -DDEBUG 
> 
>     Name: bar
>     Build-depends: foo >= 1.0
> 
>     configuration: flag(DEBUG)
>     Build-depends: ????
> 
> How can I say that I want the DEBUG version of package "bar" to depend
> on the DEBUG version of package "foo."?  Is this allowed? 

No. This is not allowed. Indeed you can't express it with the syntax.
That's because we don't record which configurations were active for a
package that was built. This is intentional.

>     Name: foo
>     Version: 1.0
> 
>     configuration: flag(debug)
>     Name: foo-debug
>     
> Otherwise, how can I have a debug and an optimized configuration of a
> given library installed at the same time? 

You can't. No current Haskell implementation supports this (without
doing things manually like using separate package databases / search
paths).

What you want is what the ghc build system refers to as a 'way'. It's a
whole other discussion I think.

Duncan



More information about the cabal-devel mailing list