Skip to content

Commit f7c8b79

Browse files
authored
Merge pull request haskell-cryptography#22 from erikd/master
Make it build with ghc 8.2
2 parents e0263af + 0d9c925 commit f7c8b79

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

HsOpenSSL.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Library
6666
base >= 4.4 && < 5,
6767
bytestring >= 0.9 && < 0.11,
6868
network >= 2.1 && < 2.7,
69-
time >= 1.5 && < 1.7
69+
time >= 1.5 && < 1.9
7070

7171
if flag(fast-bignum) && impl(ghc >= 7.10.1)
7272
-- only new integer-gmp 1.0.0 is supported

Setup.hs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE TupleSections #-}
23

34
import Distribution.Simple
45
import Distribution.Simple.Setup (ConfigFlags(..), toFlag)
56
import Distribution.Simple.LocalBuildInfo (localPkgDescr)
7+
8+
#if __GLASGOW_HASKELL__ >= 802
9+
import Distribution.PackageDescription (FlagName(..), mkFlagName)
10+
#else
611
import Distribution.PackageDescription (FlagName(..))
12+
#endif
13+
714
import Distribution.Verbosity (silent)
815
import System.Info (os)
916
import qualified Control.Exception as E (tryJust, throw)
@@ -34,13 +41,13 @@ conf descr cfg = do
3441
Right lbi -> return lbi -- library was found
3542
Left e
3643
| configConfigurationsFlags cfg
37-
`intersect` [(FlagName f, True) | f <- flags] /= [] ->
44+
`intersect` [(mkFlagName f, True) | f <- flags] /= [] ->
3845
E.throw e
3946
-- flag was set but library still wasn't found
4047
| otherwise -> do
4148
r <- forM flags $ \ f ->
4249
fmap (f,) $ tryConfig descr $
43-
setFlag f cfg { configVerbosity = toFlag silent }
50+
setFlag (mkFlagName f) cfg { configVerbosity = toFlag silent }
4451
-- TODO: configure is a long operation
4552
-- while checkForeignDeps is fast.
4653
-- Perhaps there is a way to configure once
@@ -55,21 +62,23 @@ conf descr cfg = do
5562
fs ->
5663
fail $ multipleFound fs
5764

58-
notFound =
59-
"Can't find OpenSSL library,\n\
60-
\install it via 'brew install openssl' or 'port install openssl'\n\
61-
\or use --extra-include-dirs= and --extra-lib-dirs=\n\
62-
\to specify location of installed OpenSSL library."
65+
notFound = unlines
66+
[ "Can't find OpenSSL library,"
67+
, "install it via 'brew install openssl' or 'port install openssl'"
68+
, "or use --extra-include-dirs= and --extra-lib-dirs="
69+
, "to specify location of installed OpenSSL library."
70+
]
6371

64-
multipleFound fs =
65-
"Multiple OpenSSL libraries were found,\n\
66-
\use " ++ intercalate " or " ["'-f " ++ f ++ "'" | (f,_) <- fs] ++ "\n\
67-
\to specify location of installed OpenSSL library."
72+
multipleFound fs = unlines
73+
[ "Multiple OpenSSL libraries were found,"
74+
, "use " ++ intercalate " or " ["'-f " ++ f ++ "'" | (f,_) <- fs]
75+
, "to specify location of installed OpenSSL library."
76+
]
6877

6978
setFlag f c = c { configConfigurationsFlags = go (configConfigurationsFlags c) }
7079
where go [] = []
71-
go (x@(FlagName n, _):xs)
72-
| n == f = (FlagName f, True) : xs
80+
go (x@(n, _):xs)
81+
| n == f = (f, True) : xs
7382
| otherwise = x : go xs
7483

7584
tryConfig descr flags = do
@@ -88,3 +97,8 @@ tryConfig descr flags = do
8897

8998
where ue e | isUserError e = Just e
9099
| otherwise = Nothing
100+
101+
#if __GLASGOW_HASKELL__ < 802
102+
mkFlagName = FlagName
103+
#endif
104+

0 commit comments

Comments
 (0)