fix build with Cabal 2.4 (#1799403)

https://github.com/haskell-hvr/hgettext/pull/16
This commit is contained in:
Jens Petersen 2020-02-23 17:28:00 +08:00
parent d8a9741112
commit d361b977b0
2 changed files with 71 additions and 1 deletions

View File

@ -6,7 +6,7 @@
Name: ghc-%{pkg_name}
Version: 0.1.31.0
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Haskell binding to libintl
License: BSD
@ -15,6 +15,7 @@ Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz
Source1: https://hackage.haskell.org/package/%{pkgver}/%{pkg_name}.cabal#/%{pkgver}.cabal
# End cabal-rpm sources
Patch1: https://patch-diff.githubusercontent.com/raw/haskell-hvr/hgettext/pull/16.patch#/hgettext-Cabal-2.4.patch
# Begin cabal-rpm deps:
BuildRequires: ghc-rpm-macros
@ -80,9 +81,11 @@ This package provides the Haskell %{pkg_name} profiling library.
%setup -q -n %{pkgver}
cp -bp %{SOURCE1} %{pkg_name}.cabal
# End cabal-rpm setup
%patch1 -p1 -b .orig
cabal-tweak-dep-ver base '<4.12' '<5'
cabal-tweak-dep-ver Cabal '== 2.2.*' '> 2.2'
cabal-tweak-dep-ver containers '<0.6' '<0.7'
cabal-tweak-dep-ver haskell-src-exts '<1.21' '<1.22'
%build
@ -129,6 +132,9 @@ cabal-tweak-dep-ver containers '<0.6' '<0.7'
%changelog
* Sun Feb 23 2020 Jens Petersen <petersen@redhat.com> - 0.1.31.0-9
- add fix for Cabal-2.4 (#1799403)
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.31.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

64
hgettext-Cabal-2.4.patch Normal file
View File

@ -0,0 +1,64 @@
From e930c5d0b1d9291f55a4f86d9bcdf51fcdb2cde3 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Thu, 14 Mar 2019 12:49:07 +0100
Subject: [PATCH] Fix build with cabal-2.4
https://github.com/haskell-hvr/hgettext/issues/15
---
src/Distribution/Simple/I18N/GetText.hs | 4 ++--
src/Internal.hs | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/Distribution/Simple/I18N/GetText.hs b/src/Distribution/Simple/I18N/GetText.hs
index f2bc7c8..7f9f8a5 100644
--- a/src/Distribution/Simple/I18N/GetText.hs
+++ b/src/Distribution/Simple/I18N/GetText.hs
@@ -78,7 +78,7 @@ import Distribution.Simple
import Distribution.Simple.InstallDirs as I
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
-import Distribution.Simple.Utils
+import Distribution.Simple.Utils (warn)
import Distribution.Verbosity
import Control.Arrow (second)
@@ -90,7 +90,7 @@ import System.Exit
import System.FilePath
import System.Process
-import Internal
+import Internal (fromPackageName, matchFileGlob)
-- | Default main function, same as
--
diff --git a/src/Internal.hs b/src/Internal.hs
index 69d3ea2..f1eb255 100644
--- a/src/Internal.hs
+++ b/src/Internal.hs
@@ -1,8 +1,14 @@
{-# LANGUAGE CPP #-}
-module Internal where
+module Internal (fromPackageName, matchFileGlob) where
import Distribution.Simple
+#if MIN_VERSION_Cabal(2,4,0)
+import Distribution.Simple.Glob (matchDirFileGlob)
+import Distribution.Verbosity (silent)
+#else
+import Distribution.Simple.Utils (matchFileGlob)
+#endif
fromPackageName :: PackageName -> String
#if MIN_VERSION_Cabal(2,0,0)
@@ -10,3 +16,10 @@ fromPackageName = unPackageName
#else
fromPackageName (PackageName s) = s
#endif
+
+#if MIN_VERSION_Cabal(2,4,0)
+-- | Newer versions of Cabal have removed this function in favour of more configurable implementation
+-- We assume Cabal 2.0
+matchFileGlob :: FilePath -> IO [FilePath]
+matchFileGlob = matchDirFileGlob silent (mkVersion [2, 0]) "."
+#endif