blob: 7c54604ae68a76032b4b9db92b68d8e10e0bc336 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/usr/bin/env bash
# This script can be used to generate some unregisterised .hc files
# for bootstrapping GHC on a new/unsupported platform. It involves a
# two-stage bootstrap: the first stage builds an unregisterised set of
# libraries & RTS, and the second stage builds an unregisterised
# compiler.
# Take the .hc files from the libraries of stage 1, and the compiler
# of stage 2, to the target system and bootstrap from these to get a
# working (unregisterised) compiler.
set -e
base=`pwd`
# set this to the location of your source tree
fptools_dir=$HOME/fptools
if [ ! -f b1-stamp ]; then
mkdir b1
cd b1
lndir $fptools_dir
cd ..
cd b1
./configure
# For cross-compilation, at this stage you may want to set up a source
# tree on the target machine, run the configure script there, and bring
# the resulting mk/config.h file back into this tree before building
# the libraries.
touch mk/build.mk
echo "GhcUnregisterised = YES" >> mk/build.mk
echo "GhcLibHcOpts = -O -H32m -fvia-C -keep-hc-files" >> mk/build.mk
echo "GhcLibWays =" >> mk/build.mk
echo "SplitObjs = NO" >> mk/build.mk
# We could optimise slightly by not building hslibs here. Also, building
# the RTS is not necessary (and might not be desirable if we're using
# a config.h from the target system).
make stage1
cd ..
touch b1-stamp
fi
# exit 0
if [ ! -f b2-stamp ]; then
mkdir b2
cd b2
lndir $fptools_dir
cd ..
cd b2
./configure --with-ghc=$base/b1/ghc/compiler/stage1/ghc-inplace
touch mk/build.mk
# The bootstrapped compiler should probably generate unregisterised
# code too. If you don't want it to, then comment out this line:
echo "GhcUnregisterised = YES" >> mk/build.mk
echo "SRC_HC_OPTS += -keep-hc-file -fvia-C" >> mk/build.mk
echo "GhcWithNativeCodeGen = NO" >> mk/build.mk
echo "GhcWithInterpreter = NO" >> mk/build.mk
# we just need to build the compiler and utils...
(cd glafp-utils && make boot && make)
(cd ghc && make boot)
(cd ghc/utils && make)
(cd ghc/compiler && make stage=1)
cd ..
touch b2-stamp
fi
|