Ticket #27 (closed enhancement: fixed)

Opened 3 years ago

Last modified 1 year ago

Document configurations syntax

Reported by: Simon Marlow <simonmar@microsoft.com> Assigned to: nominolo
Priority: high Milestone: Cabal-1.2
Component: Cabal library Version:
Severity: normal Keywords:
Cc: Difficulty: very easy (<1 hour)
GHC Version: 6.2.1 Platform: Linux

Description (Last modified by ijones)

Latest proposal is here. Below might be out of date.


The idea is to add support for

  • optional dependencies
  • optional stanzas in the package description

and allow selecting these options by

  • command-line options to configure, eg. --enable-debug
  • properties of the environment (eg. GHC version, platform)
  • environment variables
  • combinations of the above

possible features / use cases

  • allow different configurations to go into different build trees so they don't conflict w/ each-other?

The current syntax we have in mind is

package: foo
build-depends: base>=1.0

configuration: debug
ghc-options: -DDEBUG -O0 -Wall

configuration: !debug
ghc-options: -O

configuration: OS=windows
build-depends: Win32

configuration: !OS=windows
build-depends: unix

configuration: COMPILER=ghc
build-depends: fps

The language of the expression in a 'configuration:' field is:

 config0 ::= label
           | label=value
           | (config)

 config  ::= !config0
           | config0 | config
           | config, config

i.e. simple boolean combinations of label and label=value.

A label expression can be made true by either adding --enable-label on the configure command line, or by setting the ENABLE_label environment variable.

A 'label=value' expression can be set by either --with-label=value on the configure command line, or by setting label=value in the environment.

Configure --help will list the available --enable and --with options by examining the package description.

We might need a --disable-environment setting to disable taking settings from the environment, so that automatic packaging systems can be made more robust in the face of arbitrary environment settings.

Change History

12/11/05 12:16:11 changed by ijones

  • difficulty set to very hard.

01/07/06 12:23:06 changed by anonymous

more email between me & simon:

> "Simon Marlow" <simonmar@microsoft.com> writes:
>
>> Hi Isaac,
>>
>> I added a ticket.   At the same time I tweaked the syntax a bit more,
>> and explained how environment variables fit in.  I'm not 100% sure
>> about the details, in particular I didn't distinguish between
>> environment variables and --enable/--with settings - please take a
>> look and see what you think.
>
> I like it.  Still concerned about the stanza syntax, though.

Me too.  What would you prefer?

Are you planning to keep multiple executables, or restrict to just one?
(although it seems tempting to restrict to one executable, I now think
it might be a little too inconvenient).

How about just putting the stanza header in brackets:

-----------
[configuration: OS=windows, COMPILER=ghc]
ghc-options: -DWORKAROUND_STUPID_OS

[executable: prog]
hs-source-dirs: prog-src
-----------

Alternatively, we could use indentation:

------------
Configuration: OS=windows, COMPILER=ghc
  ghc-options: -DWORKAROUND_STUPID_OS

Executable: prog
  hs-source-dirs: prog-src
------------

the idea being like layout in Haskell.  Or do you have any other ideas?
I'm happy to implement this as part of the configuration work, BTW (I
already have some of it done).

Cheers,
       Simon

03/24/06 10:36:47 changed by ijones

  • description changed.

12/27/06 10:14:25 changed by ijones

  • platform set to Linux.
  • ghcversion set to 6.2.1.
  • description changed.

05/24/07 04:09:23 changed by guest

testing notifications.. please ignore.

05/28/07 14:06:17 changed by guest

  • owner changed from simonmar to nominolo.

09/06/07 17:49:19 changed by duncan

  • difficulty changed from very hard to very easy (<1 hour).
  • summary changed from Configurations to Document configurations syntax.
  • milestone changed from Cabal-1.4 to Cabal-1.2.

Configurations are now implemented, the latest syntax needs to be documented in the user guide.

09/26/07 05:50:27 changed by duncan

I'm part way through doing this.

11/21/07 06:08:49 changed by duncan

  • status changed from new to closed.
  • resolution set to fixed.

This got included in the 1.2.1 release.