The following procedure is suggested for installation of Hugs on a Unix machine. (Precompiled binaries are provided for common PC platforms, although similar installation procedures can be used for these machines if you have a suitable C compiler.) Short version: cd hugs/src/unix ./configure --prefix=$HOME cd .. make install make clean $HOME/bin/hugs $HOME/share/hugs/demos/Say putStr (say " /Hugs") :quit Long version: 0) Choose a directory (or directories) for the Hugs files to go in. In the following, we'll assume: /usr/local/solaris/bin user executables /usr/local/solaris/lib/hugs architecture dependent files /usr/local/lib/hugs architecture independent files Check that these directories have appropriate permission settings. 1) Run the configure script On Unix (or other platform providing sh, sed and related tools): cd hugs/src/unix ./configure --exec-prefix=/usr/local/solaris --datadir=/usr/local/lib -- This tests the capabilities of your C compiler and OS -- and arranges to install binaries in the directories places. Read hugs/src/unix/INSTALL to find out about other configuration options. Hugs specific options are listed at the end of this file. On Windows: Pick one of the following configurations: msc: Microsoft Visual C++ bcc32: 32 bit Borland C bcc16: 16 bit Borland C djgpp2: DJGPP2 cd hugs\src\{msc,bcc32,bcc16,djgpp2} config.bat If you haven't used Visual C++ or Borland C from the command line before, you might have to define some environment variables (in autoexec.bat or using "Control Panel|System") before you can use the compiler - check your compiler documentation. make hugs.exe (or nmake hugs.exe with Visual C++) If you prefer to use an integrated development environment, run "make hugs.exe -n" to get a list of the files we compile and add them to your project. On another platform: If you can't run the configure script, pick one of the Windows configurations and use it as a basis for constructing the following files hugs/src/Makefile hugs/src/options.h # Configuration options hugs/src/config.h # Description of your machine/compiler/OS 2) Build hugs and associated files cd .. make At this point, you might like to run a few tests to make sure everything's working. ./hugs -P../lib -- Run a few tests like 1+2, [1..], etc. Use ":quit" to exit 3) Install hugs in chosen directories make install (Note that the permissions of the installed files will be affected by your "umask" setting. If you want the installed files to be world readable, you need to set umask accordingly.) Try a few simple tests: /usr/local/solaris/bin/hugs [1..10] :quit cat > echo < module Main(main) where > import System(getArgs) > > main = do { args <- getArgs; putStrLn (unwords args) } EOF chmod 755 echo ./echo Hello World Administrators of sites with multiple architectures often prefer to install a shell script in /usr/local/bin which will select an appropriate binary according to the architecture on which it is run rather than a binary. Configuration should be the same as above (use a different --bindir argument for each architecture but, if you want, save a small amount of space by using the same --datadir) and use a shell script like the following. #! /bin/sh HW_OS=${HW_OS-`/usr/local/gnu/bin/hw_os`} BINDIR=/local/lib/Hugs1.4/$HW_OS exec $BINDIR/hugs $* This kind of script would also be a good place to set system-wide default options (eg to select an editor or to switch on the "show types" option). 4) Optionally run some regression tests You need to have Perl 5 to run these. Depending on your machine, these can take anywhere from 5 minutes to a couple of hours to run. make check -- A few spurious "errors" may be detected. -- o print (-0.0) may print "-0.0" instead of "0.0". -- o floatRange 0 may be "(-148,128)" (or some similar pair) -- instead of "(-125,128)". 5) Cleanup after yourself You can now run "make clean" to delete all machine-generated files. If you ran "make install", you could delete the entire hugs source tree - but you might want to keep the hugs/doc directory. Hugs specific configuration options: --with-readline Use GNU readline library (to provide line editing like that in tcsh or bash) if available. We highly recommend this option. However, it changes Hugs' user interface in a way that will cause every single regression test to fail. (On Unix, regression tests are run by "make install; make check".) --enable-timer Time how long each evaluation takes. Timing is included for the purpose of benchmarking the Hugs interpreter, comparing its performance across a variety of different machines, and with other systems for similar languages. It would be somewhat foolish to try to use the timings produced in this way for any other purpose. In particular, using timings to compare the performance of different versions of an algorithm is likely to give very misleading results. The current implementation of Hugs as an interpreter, without any significant optimizations, means that there are much more significant overheads than can be accounted for by small variations in Hugs code. --enable-profiling Gather statistics about heap allocation during evaluation. Statistics are written to a file profile.hp which may be viewed using the hp2ps program. This option makes Hugs use much more memory and run much slower. The ":set -d" command can be used to reduce the time overhead by controlling the frequency with which statistics are gathered. --with-nmake Try to generate a Makefile that will work with Microsoft's nmake. --disable-large-banner Print a single-line startup banner instead of the 9 line banner. (This option will also cause the "make check" regression tests to fail.) --enable-TREX Enable the Typed Record EXtension described in A Polymorphic Type System for Extensible Records and Variants, Benedict R. Gaster and Mark P. Jones, Technical report NOTTCS-TR-96-3, November 1996, Department of Computer Science, University of Nottingham, University Park, Nottingham NG7 2RD, England. http://www.cs.nott.ac.uk/Department/Techreports/96-3.html --with-gui Used when generating Hugs for Windows. Only works with Borland C++ --enable-internal-prims Enable experimental features used in hugs/lib/hugs/HugsInternals.hs --enable-stack-dumps Enable printing of the top and bottom few objects on the stack when stack overflow happens. This feature is currently (Sept'97) just a proof of concept. We welcome suggestions (and/or code) to make it useful for people who don't have an intimate knowledge of how the G machine operates. --enable-debug --enable-tag-checks --enable-lint For use when debugging Hugs. --with-preprocessor This is an experimental feature and may change in future versions. Enable the use of a preprocessor for processing Haskell source files before compiling them with Hugs. When configured with preprocessing on, you can use the "-F" option to specify which preprocessor to use. For example, if your preprocessor is in /users/JFH/bin/hscpp, you might say :set -F"/users/JFH/bin/hscpp" If you have perl and gcc installed on your machine, the following script provides a simple cpp-like preprocessor. eval "exec perl -S $0 $*" if $running_under_some_random_shell; # # Reads CPP output and turns #line things into appropriate Haskell # pragmas. This program is derived from the "hscpp" script # distributed with the Glasgow Haskell Compiler. # $Cpp = 'gcc -E -xc -traditional'; open(INPIPE, "$Cpp @ARGV |") || die "Can't open C pre-processor pipe\n"; while () { # line directives come in flavo[u]rs: # s/^#\s*line\s+\d+$/\{\-# LINE \-\}/; IGNORE THIS ONE FOR NOW s/^#\s*line\s+(\d+)\s+(\".+\")$/\{\-# LINE \1 \2 \-\}/; s/^#\s*(\d+)\s+(\".*\").*/\{\-# LINE \1 \2 \-\}/; print $_; } close(INPIPE) || exit(1); # exit is so we reflect any errors. exit(0); Note that Hugs currently ignores the {-# LINE _ _ #-} pragmas so error messages will refer to the wrong line numbers.