Conditional compilation of Setup.hs

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? 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. Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************

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

Hello Duncan, Tuesday, July 31, 2007, 5:06:35 PM, you wrote:
#ifdef __CABAL_VERSION__ > 117
Is something like this possible with Cabal?
No, Cabal does not define any cpp defines like that.
фафшкб one of this year GSOC projects is "Cabal sections" impelementation which should allow to make parts of cabal files specific, for example, for windows and unix. may be this new feature will allow to check library version too? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Tue, 2007-07-31 at 17:20 +0400, Bulat Ziganshin wrote:
Hello Duncan,
Tuesday, July 31, 2007, 5:06:35 PM, you wrote:
#ifdef __CABAL_VERSION__ > 117
Is something like this possible with Cabal?
No, Cabal does not define any cpp defines like that.
фафшкб one of this year GSOC projects is "Cabal sections" impelementation which should allow to make parts of cabal files specific, for example, for windows and unix. may be this new feature will allow to check library version too?
This allows conditional compilation in the library/program code but not in Setup.hs itself. Duncan
participants (3)
-
Bayley, Alistair
-
Bulat Ziganshin
-
Duncan Coutts