Permalink
Browse files

Make Scion compile on Cabal 1.11.x.

  • Loading branch information...
1 parent ac7500c commit 283cef9b1865f789b2db4938359fa68176b108fe @serras serras committed Jul 25, 2011
Showing with 93 additions and 44 deletions.
  1. +18 −2 lib/Scion/Cabal.hs
  2. +5 −0 lib/Scion/Types.hs
  3. +70 −42 scion.cabal
View
20 lib/Scion/Cabal.hs
@@ -37,17 +37,23 @@ import Data.Maybe
import qualified Data.Map as DM
import System.Directory ( doesFileExist, getDirectoryContents,
getModificationTime, removeFile )
-import System.FilePath ( (</>), dropFileName, takeExtension,dropExtension,(<.>) )
+import System.FilePath ( (</>), dropFileName, takeExtension, dropExtension, (<.>) )
import System.Exit ( ExitCode(..) )
import qualified Distribution.ModuleName as PD
( ModuleName, components )
-- FIXME: unused import Distribution.Simple.Configure
import Distribution.Simple.GHC ( ghcOptions )
+#if CABAL_VERSION > 110
+import Distribution.Simple.LocalBuildInfo hiding ( libdir, Component(..) )
+#else
import Distribution.Simple.LocalBuildInfo hiding ( libdir )
+#endif
import Distribution.Simple.Build ( initialBuildSteps )
import Distribution.Simple.BuildPaths ( exeExtension )
+#if CABAL_VERSION < 112
import Distribution.Simple.PreProcess ( knownSuffixHandlers )
+#endif
import qualified Distribution.PackageDescription as PD
import Distribution.Package
import Distribution.InstalledPackageInfo
@@ -466,7 +472,11 @@ preprocessPackage :: FilePath
preprocessPackage dist_dir = do
lbi <- liftIO $ getPersistBuildConfig (localBuildInfoFile dist_dir)
let pd = localPkgDescr lbi
+#if CABAL_VERSION > 110
+ liftIO $ initialBuildSteps dist_dir pd lbi V.normal
+#else
liftIO $ initialBuildSteps dist_dir pd lbi V.normal knownSuffixHandlers
+#endif
return ()
cabalModuleNameToTarget :: PD.ModuleName -> Target
@@ -514,6 +524,9 @@ configureCabalProject root_dir dist_dir = do
#if CABAL_VERSION > 108
, configTests = Flag True
#endif
+#if CABAL_VERSION > 110
+ , configLibCoverage = Flag True
+#endif
, configConfigurationsFlags = map (\(n,v)->(PD.FlagName n,v)) user_flags
}
@@ -529,8 +542,11 @@ configureCabalProject root_dir dist_dir = do
config_flags
#endif
liftIO $ writePersistBuildConfig dist_dir lbi
+#if CABAL_VERSION > 110
liftIO $ initialBuildSteps dist_dir (localPkgDescr lbi) lbi V.normal
- knownSuffixHandlers
+#else
+ liftIO $ initialBuildSteps dist_dir (localPkgDescr lbi) lbi V.normal knownSuffixHandlers
+#endif
return lbi
where
find_cabal_file = do
View
5 lib/Scion/Types.hs
@@ -37,7 +37,12 @@ import qualified Data.MultiSet as MS
import qualified Data.Set as Set
import qualified Data.Foldable as Fold
+#if CABAL_VERSION > 110
+import Distribution.Simple.LocalBuildInfo hiding ( Component(..) )
+#else
import Distribution.Simple.LocalBuildInfo
+#endif
+
import System.Directory
( setCurrentDirectory
, getCurrentDirectory
View
112 scion.cabal
@@ -44,6 +44,10 @@ flag cabal_1_10
description: Enable the Cabal library 1.10 features
default: False
+flag cabal_1_12
+ description: Enable the Cabal library 1.12 features
+ default: False
+
library
build-depends:
base == 4.*,
@@ -76,22 +80,28 @@ library
ghc-syb,
ghc-syb-utils,
time == 1.1.*
-
- if flag(cabal_1_10)
+
+ if flag(cabal_1_12)
build-depends:
- Cabal >= 1.10,
- hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=110
+ Cabal >= 1.11,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=112
else
- if flag(cabal_1_8)
+ if flag(cabal_1_10)
build-depends:
- Cabal >= 1.8,
+ Cabal >= 1.10,
hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=108
+ cpp-options: -DCABAL_VERSION=110
else
- build-depends:
- Cabal == 1.6.*
- cpp-options: -DCABAL_VERSION=106
+ if flag(cabal_1_8)
+ build-depends:
+ Cabal >= 1.8,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=108
+ else
+ build-depends:
+ Cabal == 1.6.*
+ cpp-options: -DCABAL_VERSION=106
hs-source-dirs: lib
extensions: CPP, PatternGuards, DeriveDataTypeable
@@ -174,21 +184,27 @@ executable scion-server
ghc-syb-utils,
time == 1.1.*
- if flag(cabal_1_10)
+ if flag(cabal_1_12)
build-depends:
- Cabal >= 1.10,
- hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=110
+ Cabal >= 1.11,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=112
else
- if flag(cabal_1_8)
+ if flag(cabal_1_10)
build-depends:
- Cabal >= 1.8,
- hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=108
+ Cabal >= 1.10,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=110
else
- build-depends:
- Cabal == 1.6.*
- cpp-options: -DCABAL_VERSION=106
+ if flag(cabal_1_8)
+ build-depends:
+ Cabal >= 1.8,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=108
+ else
+ build-depends:
+ Cabal == 1.6.*
+ cpp-options: -DCABAL_VERSION=106
if flag(server)
@@ -283,21 +299,27 @@ executable scion-test
ghc-syb-utils,
time == 1.1.*
- if flag(cabal_1_10)
+ if flag(cabal_1_12)
build-depends:
- Cabal >= 1.10,
- hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=110
+ Cabal >= 1.11,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=112
else
- if flag(cabal_1_8)
+ if flag(cabal_1_10)
build-depends:
- Cabal >= 1.8,
+ Cabal >= 1.10,
hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=108
+ cpp-options: -DCABAL_VERSION=110
else
- build-depends:
- Cabal == 1.6.*
- cpp-options: -DCABAL_VERSION=106
+ if flag(cabal_1_8)
+ build-depends:
+ Cabal >= 1.8,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=108
+ else
+ build-depends:
+ Cabal == 1.6.*
+ cpp-options: -DCABAL_VERSION=106
hs-source-dirs: lib
extensions: CPP, PatternGuards, DeriveDataTypeable
@@ -361,21 +383,27 @@ executable STypeNotes-test
filepath == 1.1.*,
ghc >= 6.10 && < 6.13
- if flag(cabal_1_10)
+ if flag(cabal_1_12)
build-depends:
- Cabal >= 1.10,
- hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=110
+ Cabal >= 1.11,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=112
else
- if flag(cabal_1_8)
+ if flag(cabal_1_10)
build-depends:
- Cabal >= 1.8,
+ Cabal >= 1.10,
hslogger >= 1.1
- cpp-options: -DCABAL_VERSION=108
+ cpp-options: -DCABAL_VERSION=110
else
- build-depends:
- Cabal == 1.6.*
- cpp-options: -DCABAL_VERSION=106
+ if flag(cabal_1_8)
+ build-depends:
+ Cabal >= 1.8,
+ hslogger >= 1.1
+ cpp-options: -DCABAL_VERSION=108
+ else
+ build-depends:
+ Cabal == 1.6.*
+ cpp-options: -DCABAL_VERSION=106
hs-source-dirs: lib
extensions: CPP, PatternGuards

0 comments on commit 283cef9

Please sign in to comment.