Browse Source

Merge pull request #34 from jonkri/master

Fix GHC 7.0 build errors, update `Tested-With', and update example
master
Jon Kristensen 13 years ago
parent
commit
3a4983f52f
  1. 10
      README.md
  2. 2
      examples/echoclient/Main.hs
  3. 44
      pontarius-xmpp.cabal
  4. 6
      source/Network/Xmpp/Stream.hs

10
README.md

@ -25,6 +25,16 @@ _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 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*. *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".
_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 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 also using the OverloadedStrings LANGUAGE pragma in order to be able to type
<code>Text</code> values like strings. <code>Text</code> values like strings.

2
examples/echoclient/Main.hs

@ -30,5 +30,5 @@ main = do
forever $ do forever $ do
msg <- getMessage sess msg <- getMessage sess
case answerMessage msg (messagePayload msg) of case answerMessage msg (messagePayload msg) of
Just answer -> sendMessage answer sess Just answer -> sendMessage answer sess >> return ()
Nothing -> putStrLn "Received message with no sender." Nothing -> putStrLn "Received message with no sender."

44
pontarius-xmpp.cabal

@ -1,6 +1,6 @@
Name: pontarius-xmpp Name: pontarius-xmpp
Version: 0.2.0.1 Version: 0.2.0.1
Cabal-Version: >= 1.6 Cabal-Version: >= 1.4
Build-Type: Simple Build-Type: Simple
License: OtherLicense License: OtherLicense
License-File: LICENSE.md License-File: LICENSE.md
@ -16,7 +16,7 @@ Synopsis: An incomplete XMPP client implementation
Description: Pontarius XMPP is a work in progress implementation of RFC 6120 Description: Pontarius XMPP is a work in progress implementation of RFC 6120
("XMPP CORE"), RFC 6121 ("XMPP IM"), and RFC 6122 ("XMPP ADDR"). ("XMPP CORE"), RFC 6121 ("XMPP IM"), and RFC 6122 ("XMPP ADDR").
Category: Network 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 Extra-Source-Files: README.md
, examples/echoclient/echoclient.cabal , examples/echoclient/echoclient.cabal
@ -28,6 +28,45 @@ Extra-Source-Files: README.md
Library Library
hs-source-dirs: source hs-source-dirs: source
Exposed: True Exposed: True
-- 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 Build-Depends: attoparsec >=0.10.0.3
, base >4 && <5 , base >4 && <5
, base64-bytestring >=0.1.0.0 , base64-bytestring >=0.1.0.0
@ -60,6 +99,7 @@ Library
, xml-types >=0.3.1 , xml-types >=0.3.1
, xml-conduit >=1.0 , xml-conduit >=1.0
, xml-picklers >=0.3.3 , xml-picklers >=0.3.3
}
Exposed-modules: Network.Xmpp Exposed-modules: Network.Xmpp
, Network.Xmpp.IM , Network.Xmpp.IM
, Network.Xmpp.Internal , Network.Xmpp.Internal

6
source/Network/Xmpp/Stream.hs

@ -39,7 +39,7 @@ import Network.DNS hiding (encode, lookup)
import Network.Xmpp.Marshal import Network.Xmpp.Marshal
import Network.Xmpp.Types import Network.Xmpp.Types
import System.IO 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.Log.Logger
import System.Random (randomRIO) import System.Random (randomRIO)
import Text.XML.Stream.Parse as XP import Text.XML.Stream.Parse as XP
@ -821,3 +821,7 @@ withStream' action (Stream stream) = do
mkStream :: StreamState -> IO Stream mkStream :: StreamState -> IO Stream
mkStream con = Stream `fmap` atomically (newTMVar con) 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)

Loading…
Cancel
Save