Haskell packages‎ > ‎

curl-win32

Getting started and set up with the curl package on Windows platforms takes a few extra steps. To hopefully help you to get going with the wonderous curl library and all its goodness, here's what you need to do to:
 
  • GHC uses mingw, so you need a mingw version of curl to go with it. Some of the contributed downloads on curl.haxx.se  do provide mingw versions, but it's easier simply to compile up from the source distribution. [Why? again, as ghc is still using gcc-3.4.x, we want to be able to make sure that we are using compatible versions of the C compiler.]
  • Either download the source distribution from curl.haxx.se or pick up the attached .zip file containing the result of doing a clean build + bundling up the output of 'make install'. It will save you some extra bother as it has been compiled up with SSL + LDAP support, so you won't have to go the extra steps of finding & downloading mingw distributions of those first.
  • Unpack that .zip file somewhere suitable.
  • 'cabal install' the curl package, supplying  some extra arguments pointing at where you put it
                     foo$ CPPFLAGS=-Ic:/packages/curl-7.19.4/include cabal install curl --ld-options=-Lc:/packages/curl-7.19.4/pre/lib
 
              (I'm assuming you are using a UNIX-like shell to invoke the above, but it should be 'obvious' how to translate it to your command shell of choice..I hope.)
  • That's pretty much it, but the contents of the bin/ directory needs to be accessible along your PATH.
  • To test, do
            foo$ ghci -package curl ..... Network.Curl.curlGetString "http://www.haskell.org/" >>= putStrLn.fst
 

Building curl from source with mingw

 
To build the contents of the attached .zip file yourself, here are the suggested steps I followed after having downloaded the latest version (7.19.4 - March 2009):
 
    foo$ cd <top of distribution tree>
    foo$ PKG_CONFIG_PATH=/c/src/openssl_mingw32-0.9.8e/:/c/src/openldap/ ./configure --with-ssl=c:/src/openssl_mingw32-0.9.8e/
    ....
    foo$ make
    foo$ mkdir curl-7.19.4
    foo$ make install prefix=`pwd`/curl-7.19.4
    ....
    foo$ cp curl-7.19.4/bin/libcurl-4.dll curl-7.19.4/bin/libcurl.dll
    foo$ cp README CHANGES COPYING curl-7.19.4/
    foo$ zip -r curl-7.19.4-mingw32.zip curl-7.19.4
 
(This assumes of course that you've got a cygwin + mingw compilation environment set up, with the mingw versions of gcc and binutils being used
over the cygwin versions. Versionwise for gcc, I'm assuming that you aren't using gcc4, but gcc-3.4.* (i.e., same as current versions of GHC.))
 
   
ċ
curl-7.19.4-mingw32.zip
(1676k)
Sigbjorn Finne,
Mar 19, 2009, 4:54 PM
Comments