From 89e139430b4e3f59976434aac17b5dae1367167a Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Fri, 30 Oct 2015 23:22:21 +0100 Subject: Fix Cabal-1.18.0 for ghc<7.8 --- CabalHelper/Compile.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CabalHelper/Compile.hs b/CabalHelper/Compile.hs index 85d4370..54771b1 100644 --- a/CabalHelper/Compile.hs +++ b/CabalHelper/Compile.hs @@ -316,8 +316,24 @@ patchyCabalVersions = [ let versionFile = dir "Distribution/Version.hs" versionFileTmp = versionFile ++ ".tmp" + let languagePragma = + "{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}" + languagePragmaCPP = + "{-# LANGUAGE CPP, DeriveDataTypeable, StandaloneDeriving #-}" + + derivingDataVersion = + "deriving instance Data Version" + derivingDataVersionCPP = unlines [ + "#if __GLASGOW_HASKELL__ < 707", + derivingDataVersion, + "#endif" + ] + vf <- readFile versionFile - writeFile versionFileTmp $ replace "deriving instance Data Version" "" vf + writeFile versionFileTmp + $ replace derivingDataVersion derivingDataVersionCPP + $ replace languagePragma languagePragmaCPP vf + renameFile versionFileTmp versionFile unpackPatchedCabal :: -- cgit v1.2.3