diff options
-rw-r--r-- | cabal-helper.cabal | 2 | ||||
-rw-r--r-- | src/CabalHelper/Runtime/Compat.hs | 16 | ||||
-rw-r--r-- | src/CabalHelper/Runtime/HelperMain.hs | 7 |
3 files changed, 20 insertions, 5 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal index c5c067c..81ebcd0 100644 --- a/cabal-helper.cabal +++ b/cabal-helper.cabal @@ -93,7 +93,7 @@ common extensions common build-deps build-depends: base < 5 && >= 4.9.1.0 - , Cabal < 3.4 && >= 3.0 + , Cabal < 3.5 && >= 3.0 || < 2.5 && >= 2.0 || < 1.26 && >= 1.24.2.0 , cabal-plan < 0.8 && >= 0.5.0.0 diff --git a/src/CabalHelper/Runtime/Compat.hs b/src/CabalHelper/Runtime/Compat.hs index c845f47..ec62581 100644 --- a/src/CabalHelper/Runtime/Compat.hs +++ b/src/CabalHelper/Runtime/Compat.hs @@ -25,6 +25,9 @@ module CabalHelper.Runtime.Compat , componentNameFromComponent , componentOutDir , internalPackageDBPath + , PackageFlag + , flagDefault + , flagName , unFlagAssignment ) where @@ -33,7 +36,6 @@ import System.FilePath import Distribution.PackageDescription ( PackageDescription , GenericPackageDescription(..) - , Flag(..) , FlagName , FlagAssignment , Executable(..) @@ -51,6 +53,13 @@ import Distribution.Simple.LocalBuildInfo , LocalBuildInfo(..) ) +#if CH_MIN_VERSION_Cabal(3,4,0) +-- >= 3.4.0 +import Distribution.PackageDescription (PackageFlag(..)) +#else +-- < 3.4.0 +import Distribution.PackageDescription (Flag(..)) +#endif #if CH_MIN_VERSION_Cabal(1,24,0) import Distribution.Package (UnitId) @@ -237,3 +246,8 @@ internalPackageDBPath lbi distPref = #ifdef NOP_UN_FLAG_ASSIGNMENT unFlagAssignment = id #endif + +#if !CH_MIN_VERSION_Cabal(3,4,0) +-- < 3.4.0 +type PackageFlag = Flag +#endif diff --git a/src/CabalHelper/Runtime/HelperMain.hs b/src/CabalHelper/Runtime/HelperMain.hs index 12271bb..983223b 100644 --- a/src/CabalHelper/Runtime/HelperMain.hs +++ b/src/CabalHelper/Runtime/HelperMain.hs @@ -33,7 +33,6 @@ import Distribution.Package import Distribution.PackageDescription ( PackageDescription , GenericPackageDescription(..) - , Flag(..) , FlagName , FlagAssignment , Executable(..) @@ -310,7 +309,9 @@ helper_main args = do $ configFlags lbi nonDefaultFlags = [ (flag_name, val) - | MkFlag {flagName=(unFlagName -> flag_name'), flagDefault=def_val} <- flagDefinitons + | flag <- flagDefinitons + , let flag_name' = unFlagName $ flagName flag + , let def_val = flagDefault flag , (unFlagName -> flag_name, val) <- flagAssgnments , flag_name == flag_name' , val /= def_val @@ -376,7 +377,7 @@ componentsInfo lvd@(lbi, v, distdir) pt = do return uiComponents -flagName' :: Distribution.PackageDescription.Flag -> String +flagName' :: PackageFlag -> String flagName' = unFlagName . flagName componentsMap :: LocalBuildInfo |