3 # This script can be used to generate some unregisterised .hc files
4 # for bootstrapping GHC on a new/unsupported platform. It involves a
5 # two-stage bootstrap: the first stage builds an unregisterised set of
6 # libraries & RTS, and the second stage builds an unregisterised
9 # Take the .hc files from the libraries of stage 1, and the compiler
10 # of stage 2, to the target system and bootstrap from these to get a
11 # working (unregisterised) compiler.
17 # set this to the location of your source tree
18 fptools_dir=$HOME/fptools
20 if [ ! -f b1-stamp ]; then
29 # For cross-compilation, at this stage you may want to set up a source
30 # tree on the target machine, run the configure script there, and bring
31 # the resulting mk/config.h file back into this tree before building
35 echo "GhcUnregisterised = YES" >> mk/build.mk
36 echo "GhcLibHcOpts = -O -H32m -fvia-C -keep-hc-files" >> mk/build.mk
37 echo "GhcLibWays =" >> mk/build.mk
38 echo "SplitObjs = NO" >> mk/build.mk
40 # We could optimise slightly by not building hslibs here. Also, building
41 # the RTS is not necessary (and might not be desirable if we're using
42 # a config.h from the target system).
52 if [ ! -f b2-stamp ]; then
59 ./configure --with-ghc=$base/b1/ghc/compiler/stage1/ghc-inplace
62 # The bootstrapped compiler should probably generate unregisterised
63 # code too. If you don't want it to, then comment out this line:
64 echo "GhcUnregisterised = YES" >> mk/build.mk
65 echo "SRC_HC_OPTS += -keep-hc-file -fvia-C" >> mk/build.mk
66 echo "GhcWithNativeCodeGen = NO" >> mk/build.mk
67 echo "GhcWithInterpreter = NO" >> mk/build.mk
69 # we just need to build the compiler and utils...
70 (cd glafp-utils && make boot && make)
72 (cd ghc/utils && make)
73 (cd ghc/compiler && make stage=1)