summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/patches/atomic-primops-Cabal-1.25.patch
blob: 712bd53092f9b7534450aecb6c1f611084d4311b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff --git a/Setup.hs b/Setup.hs
index ddf5a02..7ad1f26 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,4 +1,4 @@
-
+{-# LANGUAGE CPP #-}
 import Control.Monad (when)
 import Language.Haskell.TH
 import Distribution.Simple                (defaultMainWithHooks, simpleUserHooks, UserHooks(postConf), Args)
@@ -6,14 +6,25 @@ import Distribution.Simple.Utils          (cabalVersion)
 import Distribution.Simple.LocalBuildInfo
 import Distribution.Simple.Setup          (ConfigFlags)
 import Distribution.Version               (Version(..))
+#if MIN_VERSION_Cabal(1,25,0)
+import Distribution.Version               (mkVersion)
+#endif
 import Distribution.PackageDescription    (PackageDescription)
 import Debug.Trace
 
+#if MIN_VERSION_Cabal(1,25,0)
+versionBranch :: Version -> Version
+versionBranch = id
+#else
+mkVersion :: [Int] -> Version
+mkVersion vs = Version vs []
+#endif
+
 -- I couldn't figure out a way to do this check from the cabal file, so we drop down
 -- here to do it instead:
 checkGoodVersion :: IO ()
 checkGoodVersion =
-  if   cabalVersion >= Version [1,17,0] []
+  if   cabalVersion >= mkVersion [1,17,0]
   then putStrLn (" [Setup.hs] This version of Cabal is ok for profiling: "++show cabalVersion)
   else error (" [Setup.hs] This package should not be used in profiling mode with cabal version "++
                         show (versionBranch cabalVersion)++" < 1.17.0\n"++