Saturday, September 29, 2007

I want haskell tetris and I want it now.

What I did to get the opengl library to work with ghc:

installed ghc using "fink install ghc"
updated Cabal using the download from here and the install instructions here, basically:
runghc Setup.hs configure
runghc Setup.hs build
sudo runghc Setup.hs install
from inside the unzipped download (note sudo on install).

Next up opengl was isntalled from it's home in hackage in a similar manner. I'm a little worried because of references I found sayhing that the opengl package in darks is better.

This approach failed with an 'impossible error' using haskell 6.4. It seemed to have everything but it just didn't work.

In the end I built ghc 6.6 from source grabbed from darcs (Tho it would have been better to get the binaries) . The instructions on the ghc website are impeccable, even if it did take 6 hours on my craptop. Then it was just a matter of ensuring that the default 'ghc' command was bound to 6.6 and not 4 (playing with my ~/.profile on OS X). Then it was just a matter of rebuilding and installing Opengl (2.1) and GLUT as above and it worked. w00tage!

ghc --make -package GLUT Tetris.hs -o Tetris

No comments:

Post a Comment