To compile the HOpenGL library, you need:

   * OpenGL (quite obviously). HOpenGL is tested on Intel-Linux using
     Mesa 4.0.3 which comes with most current Linux distributions,
     with Mesa 5.0, and with Windows 2000's OpenGL (NVIDIA detonator
     driver). If you don't have an OpenGL implementation at hand, have
     a look at http://mesa3d.sourceforge.net/.

   * A fairly recent version of GHC, the Glasgow Haskell Compiler. You
     need a version with a fully functional FFI including FFI libs and
     hierarchical libraries, which means >= 5.04. If you need more
     information on how to get it, have a look the GHC home page at
     http://haskell.org/ghc/. Alas, the OpenGL/GLUT headers were
     accidentally left out from the WinDoze installer for GHC 5.04.2,
     so add the missing headers by simply unzipping
     http://haskell.org/HOpenGL/releases/OpenGL-includes.zip into your
     GHC installation directory.

     HOpenGL can probably be tweaked to work with recent versions of
     Hugs and NHC98 without too much trouble, too.

   * A non-broken (= *very* recent, >= 2.03 :-) version of Green Card,
     the FFI preprocessor for Haskell, see its home page at
     http://haskell.org/greencard/.

   * If you have a Windows platform, you have two options:

      * Cygwin (available at http://sources.redhat.com/cygwin/): You
        need to install at least the default packages, Graphics/opengl,
        Devel/gcc, and Devel/make.

      * MinGW/MSYS (available at http://www.mingw.org/): Alas, MinGW
        currently comes without a GLUT header, so unzip glut.h from
        http://haskell.org/HOpenGL/releases/OpenGL-includes.zip
        into MinGW\include\GL\. A GLUT DLL is missing, too, so copy
        http://haskell.org/HOpenGL/releases/glut32.dll into MinGW\bin\.
        The DLL is taken from Cygwin, BTW.

When you have finally arrived at the bleeding edge, things get simple.
To compile the library and the examples, do:

   ./configure
   make depend
   make all

If you have sufficient permissions, you could do

   make install

to add a "HOpenGL" package to your GHC installation. Cleaning up after
the build is done via "make clean" or "make distclean".

There are some HOpenGL-specific flags for configure, especially Electric
Fence is highly recommended when things go wrong:

   --enable-efence         link with Electric Fence Malloc Debugger
   --disable-split-objs    don't split object files in libHOpenGL.a,
   --enable-Mesa           Prefer Mesa over a vendor's native OpenGL library

If Green Card and/or your Haskell compiler is not in the PATH or needs
some special flags, you can use the following configure options:

   --with-green-card=GC    process .gc files with GC
   --with-hc=HC            compile Haskell with compiler HC
   --with-hcflags=FLAGS    compile Haskell with options FLAGS

By default, the HOpenGL library and its interface files are installed
in the location where the GHC lives, but this behaviour can be changed:

   --with-ghc-pkg=GHCPKG   use GHCPKG for package installation
   --with-config-file=CONF use CONF as package configuration file
   --with-import-dir=IDIR  install HOpenGL interface files into IDIR
   --with-library-dir=LDIR install HOpenGL library into LDIR

If the OpenGL headers are not in the standard search path of your C
compiler, you can set the environment variable to CPPFLAGS="-I/my/path"
before calling configure. Similarly, if the OpenGL library is not in
the linker search path, use LDFLAGS="-L/another/path".

A rather complicated one-line example (Bourne Shell syntax), written as
several continuation lines:

   CPPFLAGS="-I/strange/path/to/include" \
   LDFLAGS="-L/strange/path/to/lib" \
   ./configure \
   --with-hc="$HOME/path with spaces/ghc-5.04.2" \
   --with-ghc-pkg="$HOME/path with spaces/ghc-pkg" \
   --with-config-file=$HOME/my.conf \
   --with-import-dir=$HOME/imports \
   --with-library-dir=$HOME/lib

Please report cheerful stories about successful installations, tragic
failures, or simply suggestions to the address below.

Have fun!

--
Sven Panne
mailto:Sven.Panne@{informatik.uni-muenchen,BetaResearch}.de
http://www.informatik.uni-muenchen.de/~Sven.Panne
