Permalink
Browse files

Bring the example use up to date

 * Add an option to the cabal file to have it build, which is False by
   default
 * Init OpenSSL in the test program
 * Add an extra Nothing for the realm on authenticationURI
  • Loading branch information...
1 parent 142f51e commit 9104713fb9db7da6efe3a92349cb0a26e3772cee @elliottt committed Feb 20, 2011
Showing with 18 additions and 25 deletions.
  1. +0 −21 examples/Makefile
  2. +4 −3 examples/test.hs
  3. +14 −1 openid.cabal
View
@@ -1,21 +0,0 @@
-GHC=ghc -odir $(ODIR) -hidir $(ODIR) -W
-ODIR=.ghc
-HSC2HS=hsc2hs
-SRC=../src
-
-all : $(ODIR) test
-
-$(ODIR) :
- mkdir $(ODIR)
-
-test : $(ODIR)/DH.hs test.hs
- $(GHC) -lcrypto -lssl --make test -i$(SRC) $(ODIR)/DH.hs -Wall
-
-$(ODIR)/DH.hs : $(SRC)/Codec/Encryption/DH.hsc
- $(HSC2HS) $< -o $@
-
-clean :
- $(RM) -r $(ODIR)
- $(RM) test
-
-.PHONY : all clean depend
View
@@ -1,11 +1,12 @@
-import MonadLib
import Network.OpenID
+import MonadLib
import Network.Socket
import System.Environment
+import OpenSSL
-main = withSocketsDo $ do
+main = withSocketsDo $ withOpenSSL $ do
[ident,check] <- getArgs
case normalizeIdentifier (Identifier ident) of
Nothing -> putStrLn "Unable to normalize identifier"
@@ -21,7 +22,7 @@ main = withSocketsDo $ do
case eam of
Left err -> putStrLn $ "associate: " ++ show err
Right am -> do
- let au = authenticationURI am Setup p i check Nothing
+ let au = authenticationURI am Setup p i check Nothing Nothing
print au
line <- getLine
let params = parseParams line
View
@@ -1,6 +1,6 @@
name: openid
version: 0.2.0.0
-cabal-version: >= 1.6
+cabal-version: >= 1.8
synopsis: An implementation of the OpenID-2.0 spec.
description: An implementation of the OpenID-2.0 spec.
category: Network
@@ -14,6 +14,9 @@ build-type: Simple
tested-with: GHC == 6.12.1
extra-source-files: examples/Makefile, examples/test.hs examples/easy.hs
+flag examples
+ default: False
+ description: Build an example program
flag split-base
default: True
@@ -57,3 +60,13 @@ library
ForeignFunctionInterface,
GeneralizedNewtypeDeriving,
MultiParamTypeClasses
+
+executable openid-test
+ main-is: examples/test.hs
+
+ if flag(examples)
+ buildable: True
+ build-depends: base, openid, monadLib, network, HsOpenSSL
+
+ else
+ buildable: False

0 comments on commit 9104713

Please sign in to comment.