Compiling the Hugs Graphics Library (HGL) with GHC?

Morning Gentlemen, may I ask if anybody had any success using the Hugs Graphics Library with ghc? I did get it to compile and link, but it insists displaying most graphics in black on a black background which somewhat diminishes the viewing enjoyment. I'm using GreenCard 2.03 and ghc-5.02.2, compiling via the FFI (-target=ffi), since getting gc to generate ghc code (-target=ghc) doesn't work; or rather, it produces code which ghc doesn't like. And, yes I know about HOpenGL and other graphics libraries for ghc -- quick word why I want to do exactly this: we're using hugs for teaching, and the Hugs Graphics Library makes a nice addition to an introductory course in Haskell. I wanted to demonstrate that Haskell is fast enough to write wee games in (Asteroids, to be precise), if one is using a compiler. Thanks, --C.

Hi Christoph,
may I ask if anybody had any success using the Hugs Graphics Library with ghc? I did get it to compile and link, but it insists displaying most graphics in black on a black background which somewhat diminishes the viewing enjoyment.
I compiled the stuff a while ago (with GHC 5.02.1): http://www.mail-archive.com/haskell%40haskell.org/msg09806.html and it works all fine with colours and such. You didn't say which version of the HGL you compiled. The one that's in the 5.02.2 source tarball? I append the answer to a question that I got after the above posting re how to build the things. Cheers, Manuel -=-
3) what was the main thing you needed to do to make it work ? Could I just checkout the current cvs version of ghc and hslibs and make it work, or did you guys do something special ?
We took the standard release of 5.02.1 and * applied our patches (the same that are in the CVS HEAD now), * updated the hslibs/xlib/ and hslibs/graphics/ subtree to the latest CVS version, * added green-card (needed to compile xlib), and [This step might not be required for win32.] * used some slightly weird sequence of `make' commands to build the whole thing. (The exact combination of commands is encoded in the rpm .spec file that is in the source rpm package if you want to have a look at it, but the sequence will be somewhat different for win32.)

Hi Manuel,
I compiled the stuff a while ago (with GHC 5.02.1):
http://www.mail-archive.com/haskell%40haskell.org/msg09806.html
and it works all fine with colours and such. You didn't say which version of the HGL you compiled. The one that's in the 5.02.2 source tarball?
No, the one I just grabed off the Hugs webpage. I didn't even know HGL was in the ghc/hslibs sources, I have to admit. Turns out the actual sources are equal, but careful perusal of the Makefile in hslibs revealed the vital clue: the -monly-3-reg option. Compiling HGL with that makes ghc not choke on GreenCard's ghc-targetted output (which it did before), and moreover makes it run in full colour. Excellent, thanks again for the help. --C.
participants (3)
-
Christoph Lueth
-
Christoph Lueth
-
Manuel M. T. Chakravarty