From 2a712a80d38a81d6423f2b1552b83d8f848ce931 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Mon, 10 Jun 2013 22:45:04 +0200 Subject: [PATCH 1/6] Cap `bytestring' dependency For some reason, `bytestring' versions above 0.9.2.1 causes (at least) GHC 7.0.1 to panic, so I capped the version while investigating the issue. --- pontarius-xmpp.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index 3322b92..cbeacda 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -32,7 +32,7 @@ Library , base >4 && <5 , base64-bytestring >=0.1.0.0 , binary >=0.4.1 - , bytestring >=0.9.1.9 + , bytestring >=0.9.1.9 && <=0.9.2.1 , conduit >=0.5 , containers >=0.5.0.0 , crypto-api >=0.9 From 699a5cef99d20bc13b31fc926c0d5c988cb94866 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Mon, 10 Jun 2013 22:49:27 +0200 Subject: [PATCH 2/6] Specify and mention `cabal-install' dependency The `cabal-install' dependency needs to be at least 1.14 so that the build of `lifted-base' will not fail with an "unrecognized option: --disable-benchmarks" error. --- README.md | 5 +++++ pontarius-xmpp.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63fbd06..216eab4 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ _Note:_ You will need the ICU Unicode library and it's header files in order to be able to build Pontarius XMPP. On Debian, you will need to install the *libicu-dev* package. In Fedora, the package is called *libicu-devel*. +_Note to GHC 7.0 users:_ You will need *cabal-install*, version *0.14.0* or +higher, or the build will fail with an "unrecognized option: +--disable-benchmarks" error. The versions *1.16.0* and higher might not build on +your system; if so, install *0.14.0* with "cabal install cabal-install-0.14.0". + The first thing to do is to import the modules that we are going to use. We are also using the OverloadedStrings LANGUAGE pragma in order to be able to type Text values like strings. diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index cbeacda..c3637a4 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -1,6 +1,6 @@ Name: pontarius-xmpp Version: 0.2.0.1 -Cabal-Version: >= 1.6 +Cabal-Version: >= 1.4 Build-Type: Simple License: OtherLicense License-File: LICENSE.md From ecdcfc0081900e7c6aa4d8a76f80474147c34072 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Mon, 10 Jun 2013 22:51:27 +0200 Subject: [PATCH 3/6] Stream.hs: Add `tryIOError', not available in `base-4.2' --- source/Network/Xmpp/Stream.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index d5460bb..c5901b0 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -39,7 +39,7 @@ import Network.DNS hiding (encode, lookup) import Network.Xmpp.Marshal import Network.Xmpp.Types import System.IO -import System.IO.Error (tryIOError) +-- import System.IO.Error (tryIOError) <- Only available in base >=4.4 import System.Log.Logger import System.Random (randomRIO) import Text.XML.Stream.Parse as XP @@ -821,3 +821,7 @@ withStream' action (Stream stream) = do mkStream :: StreamState -> IO Stream mkStream con = Stream `fmap` atomically (newTMVar con) + +-- "Borrowed" from base-4.4 for compatibility with GHC 7.0.1. +tryIOError :: IO a -> IO (Either IOError a) +tryIOError f = catch (f >>= \r -> return (Right r)) (return . Left) From 1fcb94eb6acbacb7336bcee74c108f7d06f05c8c Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Tue, 11 Jun 2013 01:29:17 +0200 Subject: [PATCH 4/6] Conditional dependencies for GHC 7.0.1 and README.md note --- README.md | 5 +++ pontarius-xmpp.cabal | 104 ++++++++++++++++++++++++++++++------------- 2 files changed, 77 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 216eab4..a4bcbfa 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ higher, or the build will fail with an "unrecognized option: --disable-benchmarks" error. The versions *1.16.0* and higher might not build on your system; if so, install *0.14.0* with "cabal install cabal-install-0.14.0". +_Note to GHC 7.0.1 users:_ You will want to configure your Cabal environment +(including *cabal-install*) for *bytestring*, version *0.9.2.1*. We recommend +that you run "cabal install bytestring-0.9.2.1 cabal-install-0.14.0" prior to +installing Pontarius XMPP. + The first thing to do is to import the modules that we are going to use. We are also using the OverloadedStrings LANGUAGE pragma in order to be able to type Text values like strings. diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index c3637a4..c5f9b6d 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -28,38 +28,78 @@ Extra-Source-Files: README.md Library hs-source-dirs: source Exposed: True - Build-Depends: attoparsec >=0.10.0.3 - , base >4 && <5 - , base64-bytestring >=0.1.0.0 - , binary >=0.4.1 - , bytestring >=0.9.1.9 && <=0.9.2.1 - , conduit >=0.5 - , containers >=0.5.0.0 - , crypto-api >=0.9 - , crypto-random-api >=0.2 - , cryptohash >=0.6.1 - , cryptohash-cryptoapi >=0.1 - , data-default >=0.2 - , dns >=0.3.0 - , hslogger >=1.1.0 - , iproute >=1.2.4 - , lifted-base >=0.1.0.1 - , mtl >=2.0.0.0 - , network >=2.4.1.0 - , pureMD5 >=2.1.2.1 - , resourcet >=0.3.0 - , random >=1.0.0.0 - , split >=0.1.2.3 - , stm >=2.1.2.1 - , stringprep >=0.1.3 - , text >=0.11.1.5 - , tls >=1.1.0 - , tls-extra >=0.5.0 - , transformers >=0.2.2.0 - , void >=0.5.5 - , xml-types >=0.3.1 - , xml-conduit >=1.0 - , xml-picklers >=0.3.3 + -- The only different between the below two blocks is that the first one caps + -- the range for the `bytestring' package. + If impl(ghc == 7.0.1) + { + Build-Depends: attoparsec >=0.10.0.3 + , base >4 && <5 + , base64-bytestring >=0.1.0.0 + , binary >=0.4.1 + , bytestring >=0.9.1.9 && <=0.9.2.1 + , conduit >=0.5 + , containers >=0.5.0.0 + , crypto-api >=0.9 + , crypto-random-api >=0.2 + , cryptohash >=0.6.1 + , cryptohash-cryptoapi >=0.1 + , data-default >=0.2 + , dns >=0.3.0 + , hslogger >=1.1.0 + , iproute >=1.2.4 + , lifted-base >=0.1.0.1 + , mtl >=2.0.0.0 + , network >=2.4.1.0 + , pureMD5 >=2.1.2.1 + , resourcet >=0.3.0 + , random >=1.0.0.0 + , split >=0.1.2.3 + , stm >=2.1.2.1 + , stringprep >=0.1.3 + , text >=0.11.1.5 + , tls >=1.1.0 + , tls-extra >=0.5.0 + , transformers >=0.2.2.0 + , void >=0.5.5 + , xml-types >=0.3.1 + , xml-conduit >=1.0 + , xml-picklers >=0.3.3 + } + else + { + Build-Depends: attoparsec >=0.10.0.3 + , base >4 && <5 + , base64-bytestring >=0.1.0.0 + , binary >=0.4.1 + , bytestring >=0.9.1.9 + , conduit >=0.5 + , containers >=0.5.0.0 + , crypto-api >=0.9 + , crypto-random-api >=0.2 + , cryptohash >=0.6.1 + , cryptohash-cryptoapi >=0.1 + , data-default >=0.2 + , dns >=0.3.0 + , hslogger >=1.1.0 + , iproute >=1.2.4 + , lifted-base >=0.1.0.1 + , mtl >=2.0.0.0 + , network >=2.4.1.0 + , pureMD5 >=2.1.2.1 + , resourcet >=0.3.0 + , random >=1.0.0.0 + , split >=0.1.2.3 + , stm >=2.1.2.1 + , stringprep >=0.1.3 + , text >=0.11.1.5 + , tls >=1.1.0 + , tls-extra >=0.5.0 + , transformers >=0.2.2.0 + , void >=0.5.5 + , xml-types >=0.3.1 + , xml-conduit >=1.0 + , xml-picklers >=0.3.3 + } Exposed-modules: Network.Xmpp , Network.Xmpp.IM , Network.Xmpp.Internal From b64266e63bc957e8c97acd71a09bb8e6718c3e2d Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Tue, 11 Jun 2013 01:37:53 +0200 Subject: [PATCH 5/6] Update example for new `sendMessage' return value --- examples/echoclient/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/echoclient/Main.hs b/examples/echoclient/Main.hs index 35b17ef..9f2730b 100644 --- a/examples/echoclient/Main.hs +++ b/examples/echoclient/Main.hs @@ -30,5 +30,5 @@ main = do forever $ do msg <- getMessage sess case answerMessage msg (messagePayload msg) of - Just answer -> sendMessage answer sess + Just answer -> sendMessage answer sess >> return () Nothing -> putStrLn "Received message with no sender." From b7fc1a137c347e32bd8dc33d9294707974f7d216 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Tue, 11 Jun 2013 02:10:40 +0200 Subject: [PATCH 6/6] pontarius-xmpp.cabal: Update `Tested-With' for new test environment I have now finished setting up a Debian Wheezy testing environment for building Pontarius XMPP against all GHC 7.0+ versions. --- pontarius-xmpp.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index c5f9b6d..f47d74b 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -16,7 +16,7 @@ Synopsis: An incomplete XMPP client implementation Description: Pontarius XMPP is a work in progress implementation of RFC 6120 ("XMPP CORE"), RFC 6121 ("XMPP IM"), and RFC 6122 ("XMPP ADDR"). Category: Network -Tested-With: GHC ==7.0.4, GHC ==7.4.1 +Tested-With: GHC >=7.0.1 && <=7.6.3 Extra-Source-Files: README.md , examples/echoclient/echoclient.cabal