[Haskell-cafe] Re: Conditional compilation of Setup.hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Jul 31 09:06:35 EDT 2007


On Tue, 2007-07-31 at 13:46 +0100, Bayley, Alistair wrote:
> I'd like to add a #ifdef to Takusen's Setup.hs, so that we can have a
> single source file that will compile with ghc-6.6 and ghc-6.6.1. With
> ghc-6.6 and Cabal-1.1.6.1 we use splitFileName and joinPaths from
> Distribution.Compat.FilePath. With ghc-6.6.1 (which includes
> Cabal-1.1.6.2) these have been moved to System.FilePath. I'd like to do
> something like the following:
> 
> #ifdef __CABAL_VERSION__ > 117
> import System.FilePath (splitFileName, combine)
> joinPaths = combine
> #else
> import Distribution.Compat.FilePath (splitFileName, joinPaths)
> #endif
> 
> Is something like this possible with Cabal?

No, Cabal does not define any cpp defines like that.

> It's either that, or make Takusen's install depend on filepath. I'm
> not sure which is the least desirable, but I'm open to suggestions.
> 
> To be fair, we already require our ghc-6.6 users to upgrade Cabal from
> 1.1.6 to 1.1.6.1, so making them install filepath instead perhaps
> isn't so bad, and is no more effort.

I'd got with filepath in that case.

Duncan



More information about the Haskell-Cafe mailing list