[Haskell-cafe] Cabal and more than one version
leather at cs.uu.nl
Mon Feb 2 07:18:40 EST 2009
I'm bringing up an old thread, because it's very relevant to my problem.
On Tue, Nov 18, 2008 at 22:30, Duncan Coutts wrote:
> On Tue, 2008-11-18 at 01:48 -0800, Jason Dusek wrote:
> > I'd like to be able to do something like:
> > if (template-haskell < 2.3)
> > cpp-options: -D TH_THE_YOUNGER
> > else
> > cpp-options: -D TH_THE_ELDER
> > I guess this kind of thing is not possible at present?
> It is possible, in two different ways.
> The easiest way is that if you're using Cabal-1.6 then it provides cpp
> macros to test the version number of packages you're using.
> #if MIN_VERSION_template_haskell(2,3,0)
> The alternative that works back to Cabal-1.2 is to use:
> flag newer-th
> if flag(newer-th)
> build-depends: template-haskell >= 2.3
> cpp-options: -D TH_THE_ELDER
> build-depends: template-haskell < 2.3
> cpp-options: -D TH_THE_YOUNGER
Either I'm doing something wrong or this doesn't work for cabal-install and
GHC 6.8.3. I used the "flag newer-th" approach in EMGM:
description: Define a CPP flag that enables conditional compilation
for template-haskell package version 2.3 and newer.
build-depends: base >= 3.0 && < 4.0,
template-haskell < 2.4
-- Include deriveRep for Loc. This was introduced with
-- template-haskell-2.3, included with GHC 6.10.
build-depends: template-haskell >= 2.3
build-depends: template-haskell < 2.3
When I run cabal install emgm (with GHC 6.8.3 and either Cabal 1.2 or 1.6),
it tries (and fails) to install template-haskell-2.3. That's exactly what I
don't want. Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe