first cut at configurations patch, and a couple more
Simon Marlow
simonmarhaskell at gmail.com
Wed Aug 2 06:11:22 EDT 2006
Simon Marlow wrote:
> Ok, spurned on by the possibiliy of worse merges to come, I've cleaned
> up my current code, merged it up to date, and made it work (where "work"
> means "doesn't make anything worse" - i.e. there is no new functionality
> exposed to the user yet).
A little bit more about configurations. Here's what you can do with them:
(a) enable some compiler options if --enable-debug is given to 'setup configure'
configuration: debug
ghc-options: -DDEBUG -O0
configuration: !debug
ghc-options: -O2
(b) depend on HUnit if --enable-debug is given:
configuration: debug
build-depends: HUnit-1.0
(c) if the base package is <2.0, depend on fps:
configuration: package(base-any, <2.0)
build-depends: fps>=1.0
ghc-options: -DUSE_FPS
(d) build executable E only if package P is available. Actually I'm not really
sure we want this, the executable could always go in a separate package.
Anyway, if we want it, perhaps something like:
configuration: !package(P)
disable-executable: E
(e) Change dependencies depending on the operating system:
configuration: os(windows)
build-depends: Win32
configuration: !os(windows)
build-depends: unix
The conditional in a "configuration:" field has the following syntax:
cond ::= STRING
| cond || cond
| cond && cond
| !cond
| 'package'(dependency)
| 'package'(dependency, version-range)
| 'os'(STRING)
| 'arch'(STRING)
Cheers,
Simon
More information about the cabal-devel
mailing list