| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 
 | Building hsSDL on Win32
-----------------------
Bit Connor <bit@mutantlemon.com>
This is how I managed to get hsSDL working on Windows XP.
I used GHC version 6.6.1
1. Download the SDL mingw development package from the SDL website
   http://www.libsdl.org
   The file I used was SDL-devel-1.2.12-mingw32.tar.gz
2. Extract it somewhere. You will get a directory called SDL-1.2.12
   I used C:\SDL-1.2.12
3. Modify SDL.cabal file from hsSDL distribution.
   A. There is a line:
          Extra-Libraries: SDL
      Change it to:
          Extra-Libraries: SDL.dll SDLmain
   B. Add two new lines to the end of the file:
          Include-Dirs: C:\SDL-1.2.12\include
          Extra-Lib-Dirs: C:\SDL-1.2.12\lib
4. Open a Windows Command Prompt (Start -> Run -> "cmd.exe")
   cd into the hsSDL distribution directory and run:
       runghc Setup.lhs configure
   I got an error at the end, about a missing sh:
       ...
       configure: Using hsc2hs: C:\ghc\ghc-6.6.1\bin\hsc2hs.exe
       configure: No c2hs found
       configure: No cpphs found
       configure: No greencard found
       Setup.lhs: Cannot find: sh
   I ignored the error, and didn't have any problems.
   Next run:
       runghc Setup.lhs build
   Finally, run:
       runghc Setup.lhs install
5. Compile the example program. Run:
       cd Examples
       ghc --make Test.hs
   You should get a Test.exe file.
   Before running it, copy the SDL.dll file into the directory. You can find
   it here:
       C:\SDL-1.2.12\bin\SDL.dll
   Now run Test.exe, press spacebar a few times to watch the smiley face jump
   around, and finally press Q to quit.
6. Using SDL from GHCi requires a trick. If you try running Test.hs you will
   get this error:
       > ghci Test.hs
       Prelude Main> main
       Loading package SDL-0.4.0 ... can't load .so/.DLL for: SDLmain (addDLL: unknown
       error)
   To get ghci working, you must make 2 copies of SDL.dll called SDLmain.dll,
   and SDL.dll.dll:
       copy SDL.dll SDLmain.dll
       copy SDL.dll SDL.dll.dll
   Now everything should work!
Peace,
Bit Connor <bit@mutantlemon.com>
 |