From 7a48f23cd97d073249c865d89c28d0838e24a371 Mon Sep 17 00:00:00 2001 From: ARATA Mizuki Date: Wed, 27 Nov 2024 21:47:17 +0900 Subject: [PATCH] Allow base-4.21 and Cabal 3.14.0 --- fp-ieee/fp-ieee.cabal | 2 +- rounded-hw/Setup.hs | 8 ++++++++ rounded-hw/rounded-hw.cabal | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fp-ieee/fp-ieee.cabal b/fp-ieee/fp-ieee.cabal index c66ce8a..755bc8f 100644 --- a/fp-ieee/fp-ieee.cabal +++ b/fp-ieee/fp-ieee.cabal @@ -72,7 +72,7 @@ common deps -- We use a post-GHC 8.6 language extension: NumericUnderscores -- cast{Word32,Word64}To{Float,Double}, cast{Float,Double}To{Word32,Word64} are since base-4.10.0.0 (GHC 8.2) -- Semigroup((<>)) is exported from Prelude since base-4.11.0.0 (GHC 8.4) - base >=4.12 && <4.21 + base >=4.12 && <4.22 if !flag(pure-hs) cpp-options: -DUSE_FFI if !flag(pure-hs) && os(windows) diff --git a/rounded-hw/Setup.hs b/rounded-hw/Setup.hs index ceee4ae..477c3d0 100644 --- a/rounded-hw/Setup.hs +++ b/rounded-hw/Setup.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} import Distribution.Simple import Distribution.Simple.Configure (configure) import Distribution.Simple.PackageIndex (allPackages) @@ -6,6 +7,9 @@ import qualified Distribution.Types.InstalledPackageInfo as InstalledPackageInfo import Distribution.Types.Library (Library (libBuildInfo)) import Distribution.Types.LocalBuildInfo (LocalBuildInfo (installedPkgs, localPkgDescr)) import Distribution.Types.PackageDescription (PackageDescription (library)) +#if MIN_VERSION_Cabal(3, 14, 0) +import Distribution.Utils.Path (makeSymbolicPath) +#endif {- We want to access "ghcconfig.h" from assembly source file (.S), @@ -21,7 +25,11 @@ main = defaultMainWithHooks simpleUserHooks { confHook = myConfHook } let extraIncludeDirs :: [String] extraIncludeDirs = concatMap InstalledPackageInfo.includeDirs (allPackages $ installedPkgs localBuildInfo) updateBuildInfo :: BuildInfo -> BuildInfo +#if MIN_VERSION_Cabal(3, 14, 0) + updateBuildInfo bi = bi { includeDirs = includeDirs bi ++ map makeSymbolicPath extraIncludeDirs } +#else updateBuildInfo bi = bi { includeDirs = includeDirs bi ++ extraIncludeDirs } +#endif updateLibrary :: Library -> Library updateLibrary lib = lib { libBuildInfo = updateBuildInfo (libBuildInfo lib) } updatePkgDescr :: PackageDescription -> PackageDescription diff --git a/rounded-hw/rounded-hw.cabal b/rounded-hw/rounded-hw.cabal index d786a61..2419f8d 100644 --- a/rounded-hw/rounded-hw.cabal +++ b/rounded-hw/rounded-hw.cabal @@ -32,8 +32,8 @@ source-repository head -- Custom setup is required to allow assembly sources to #include "ghcconfig.h" custom-setup setup-depends: - Cabal >=3.0 && <3.15 - , base >=4.12 && <4.21 + Cabal >=3.0 && <3.17 + , base >=4.12 && <4.22 flag pure-hs description: Disable FFI @@ -68,7 +68,7 @@ flag float128 common deps build-depends: array >=0.5.2.0 && <0.6 - , base >=4.12 && <4.21 + , base >=4.12 && <4.22 , deepseq >=1.4.4.0 && <1.6 , fp-ieee ==0.1.* , primitive >=0.6.1.1 && <0.10