diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2015-10-30 23:22:21 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2015-10-30 23:34:49 +0100 |
commit | 89e139430b4e3f59976434aac17b5dae1367167a (patch) | |
tree | a27908ebbd95fc73b2b681d7baf75d4441439aae /CabalHelper | |
parent | 563aa546821b1ddb4fdf87ad43cb739411f197cc (diff) |
Fix Cabal-1.18.0 for ghc<7.8
Diffstat (limited to 'CabalHelper')
-rw-r--r-- | CabalHelper/Compile.hs | 18 |
1 files changed, 17 insertions, 1 deletions
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 :: |