(→Building on Windows)
(→Getting the Code: remove reference to yhc stable)
Revision as of 12:03, 10 March 2006
|Part of Yhc|
You need a C compiler - both gcc and MS Visual C are known to be OK.
If you want to build the yhc compiler itself (not strictly necessary), you will need a very recent Haskell compiler, e.g. ghc >= 6.4. The supplied configure script will not detect if your compiler version is too old, and will not accept alternative names like ghc-6.4 instead of ghc.
The build requires Cpphs, but the makefiles will detect if this is missing and download it for you. This downloading requires darcs.
2 Getting the Code
The source code is stored in a darcs repo, to get the code do:
You can browse the code and its history on-line through a darcsweb interface.
3 Building on Windows
Open a console at the root of the yhc tree. There is a file called Makefile.bat, which is used to build the various components. Just typing Makefile should give you a list of the options.
The modes are:
- yhc - build the compiler, requires GHC
- yhi - build the runtime, requires Visual Studio 2003 (ask for support for other compilers)
- yhe - build the evaluator, requires GHC
- gyhe - build the graphic evaluator, requires GHC and Gtk2Hs
- doc - build the documentation, requires haddock and GHC
- lib - build the base libraries
- test - run the standard tests, option 98 is useful to just run the conformance tests
The standard options are:
- debug - build in debug mode [default]
- release - build in release mode
All compiled binaries will go into \inst\bin. To compile and run the test suite do:
$ Makefile yhc $ Makefile yhi $ Makefile yht $ Makefile lib $ set YHC_BASE_PATH=<current directory>\inst $ Makefile test 98
You may wish to set your YHC_BASE_PATH globally, in which case go to My Computer, Properties, Advanced, Environment Variables, New.
To ensure you have the latest version of all the source, run:
$ Makefile pull
4 Building on Linux/Unix
The standard unix thing will should get you most of the way.
chmod +x configure # because darcs does't record the executable bit ./configure make
There currently isn't a 'make install', but it is fairly trivial: simply copy the contents of the 'inst' directory into where everything should be installed. If it complains about the YHC_BASE_PATH environment variables, set this in by editing /etc/bash.bashrc and add the line
(if your system uses bash as the default shell), where /usr/lib/yhc is wherever you put your /inst folder.
If your Haskell compiler has a name other than ghc, edit the file Makefile.inc in the root, and change HC=ghc to HC=your_compiler.
5 Building on Mac OS X
You will need to have libraries like GMP (Gnu multi-precision arithmetic) installed. Most people do this with Fink or DarwinPorts, or some such. You need the header files in addition to the library archive, and these are often distributed in a 'devel' version of the package.
If your packaging system uses a separate directory hierarchy (Fink uses /sw) then you may need to set up some environment variables so that the C compiler can find the includes and libraries:
LD_LIBRARY_PATH=/sw/lib # for dylibs LIBRARY_PATH=/sw/lib # for static linking CPATH=/sw/include # for header files
Then just follow the usual unix-like procedure, as above.