[Haskell-cafe] Alternative dependencies in Cabal file
matthias.reisner at googlemail.com
Wed Mar 17 09:13:38 EDT 2010
Thanks, I missed that the flags are set dynamically if a dependency
cannot be satisfied.
Am 17.03.2010 13:23 schrieb Daniel Fischer:
> Am Mittwoch 17 März 2010 12:11:53 schrieb Matthias Reisner:
>> for a package I need to ensure the user uses a certain package
>> configuration. So how would I rewrite the following pseudo-cabal
>> Build-Depends: packageA < X, packageB < Y
>> packageA >= X && < X', packageB >= Y && < Y'
>> packageA >= X', packageB >= Y'
>> Build-Depends: ... common dependencies ...
>> where neither A nor B is the base package. Maybe I have to use if/else
>> blocks, but I don't know what conditions to use then.
> Read http://www.haskell.org/ghc/docs/latest/html/Cabal/authors.html for a
> general description of what you can do, I'd try something like in
> flag oldAB
> description: ancient packages A and B
> default: False
> flag newAB
> description: shiny new A and B
> Library blubb
> if flag(newAB)
> build-depends: packageA >= X', packageB >= Y'
> else if flag(oldAB)
> build-depends: packageA < X, packageB < Y
> build-depends: packageA >= X && < X', packageB >= Y && < Y'
> If I remember correctly, that tries first to build against the new A and B,
> that failing, it sets flag newAB to false and tries again, first with the
> not-so-ancient A and B, hopefully (but I'm not sure about the order in
> which flags are toggled if the defaults don't give a successful install
More information about the Haskell-Cafe