Compiling AMuZed/ZooM Under Various Platforms

http://www.cs.waikato.ac.nz/Research/fm/amuzed.html


** To compile under Windows, you’ll need:
 
-         The MSYS and MinGW kits (both available at http://www.mingw.org/ ) to provide apps such as make, ld, dlltool etc. Also includes pexports, so don’t worry about finding it when it’s mentioned (with a dead link) in other documentation.
 
-         SED (Stream Editor - http://www.cornerstonemag.com/sed/ - download sed3028a.zip or the closest it offers). The makefile that generates .a files in the tcl/bin directory uses this.
 
-         GHC 5.02.3 ( http://www.haskell.org/ghc/ ). This is the first version with a Windows installer. Later versions may have trouble compiling TclHaskell, AMuZed and ZooM.
 
-         TclHaskell 1.2 ( http://www.dcs.gla.ac.uk/~meurig/TclHaskell/ ). Quite simply lets you call Tcl/Tk through Haskell. Sadly, the last update was on 3 October 2001.
 
-         Tcl/Tk – You should get this one with the MinGW, if not, there’s a download link from the same page you got MinGW from. Don’t use the Cygwin or ActiveState ones. Some documentation mentions a company called “Scriptics” – don’t worry about them, as they have since dissolved.
 
-         AMuZed/ZooM source ( http://www.cs.waikato.ac.nz/Research/fm/amuzed.html ).
 
-         Sigbjorn Finne’s TclHaskell patch – May or may not be necessary, but it does allow TclHaskell to compile under GHC 6.0.1. There will either be a link to this on the AMuZed/ZooM website mentioned above. Hopefully the TclHaskell page will one day feature the patched code.


And to setup, compile and run under Windows:
 
1. Install MinGW, MSYS, SED, and GHC and include them in your path. Only GHC needs admin privileges. MinGW and MSYS do try to write a .ini file to c:/windows, but it can get by without it.
 
2. Unpack TclHaskell. (The rest of the instructions are from Readme.ghc.txt in the TclHaskell directory, with additions by me).
 
3. In the TclHaskell1.2/src directory copy makefile.nt to makefile
 
4. Modify the makefile to point to the correct installation directory and to set $TCLROOT to point to the root of your Tcl-Tk distribution.
 
Also: add “-package lang” to the GHC command line options variable $GHC_OPTS, and (this one took me a while) the $TCLLIBDIR defaults as tcl/bin – things work out a lot better if you set it to tcl/lib
 
5. Run make install to build TclHaskell.
 
Under Windows 98, it didn’t always build everything, and then complained during the make. Just use the missing file as the target with make (e.g. if foo.o is missing, run make foo.o, then try make install again)
 
6. Put this ( http://www.dcs.gla.ac.uk/~sof/Makefile-dll ) into tcl/bin and rename it as makefile. Run make all here to generate a .a import library for each .dll in the directory. Copy libtcl*.a and libtk*.a to the directory that libHSTclHaskell.a was installed in. In my case, * = 84.
 
This process is taken from http://www.dcs.gla.ac.uk/~sof/ghc-win32-libs.html which gives the reason for doing this and a few notes on compiling .c programs.
 
7. Modify tclhaskell.conf.nt so that it points to the correct installation directory. Also modify the tcl/tk ld options to refer to the correct version of tcl-tk. They say -ltk83 referring to tk8.3
 
8. Modify the $PKGFILE variable in tclhaskell/makefile to point to
  path/to/package.conf where path/to/ points to the directory
  that GHC was installed in.
 
9. Run make pkg to install the TclHaskell package into GHC.

10. Now to compile the AMuZed / ZooM source. The following two lines do the trick:
    ghc --make –package TclHaskell –o AMuZed AMuZed.hs
    ghc --make –package
TclHaskell –o ZooM ZooM.hs

 
 
11. In order to run those AMuZed and ZooM, you’ll need to include the following two directories to your path: The directory where the TclHaskell makefile installed its .dll and .a files, and mingw/bin (for tcl84.dll and tk84.dll). Also set environment variable TCL_LIBRARY to ‘mingw\lib\tcl8.4’. This should be all you need.

** Compiling under Linux:
 
You’ll need:
 
GHC 5.00.2 ( http://www.haskell.org/ghc/ ).
 
Tcl/Tk ( www.tcl.tk ) - Both binaries and source are available.
 
TclHaskell 1.2 ( http://www.dcs.gla.ac.uk/~meurig/TclHaskell/ ). Quite simply lets you call Tcl/Tk through Haskell. Sadly, the last update was on 3 October 2001. 
 
AMuZed/ZooM source ( http://www.cs.waikato.ac.nz/Research/fm/amuzed.html ).
 
You’ll do:
 
-         Install GHC and Tcl/Tk. 
-         Compile TclHaskell1.2 + install. You’ll need access to GHC’s package.conf, which may need admin.
-          Now to compile the AMuZed / ZooM source. The following two lines do the trick:
    ghc --make –package TclHaskell –o AMuZed AMuZed.hs
    ghc --make –package TclHaskell –o ZooM ZooM.hs
-         Run either application under X11 using ./<app name>.

** Compiling under Mac OS X:
 
You’ll need:
 
GHC 5.04 ( http://www.haskell.org/ghc/ ). This is the first version with a Mac OSX installer. Thankfully, it doesn’t give some of the compile errors that the Linux 5.04 version gave.
 
Tcl/Tk ( http://www.apple.com/downloads/macosx/unix_open_source/tcltkaqua.html ) There’s a 15 meg, 5 meg and possibly a smaller one available. There is a note in the documentation about programs compiled under OS 10.1 vs. 10.2, but that doesn’t matter too much as X11 requires 10.3. You could build it from the source, but that’s tricky and time consuming.
 
TclHaskell 1.2 ( http://www.dcs.gla.ac.uk/~meurig/TclHaskell/ ). Quite simply lets you call Tcl/Tk through Haskell. Sadly, the last update was on 3 October 2001. There is no Mac makefile, so a Linux build will do. Check the include directories.
 
X11 ( http://www.apple.com/downloads/macosx/apple/x11formacosx.html ) “An implementation of the X Window System that makes it possible to run X11-based applications in Mac OS X.”
 
AMuZed/ZooM source ( http://www.cs.waikato.ac.nz/Research/fm/amuzed.html ).
 
You’ll do:
 
-         Install GHC, Tcl/Tk and X11. The .dmg installers are great, and will require admin priviledges.
-         Compile TclHaskell1.2 + install. You’ll need access to GHC’s package.conf, which may need admin.
-          Now to compile the AMuZed / ZooM source. The following two lines do the trick:
    ghc --make –package TclHaskell –o AMuZed AMuZed.hs
    ghc --make –package TclHaskell –o ZooM ZooM.hs

-         Run either application under X11 using ./<app name>.