7 * Build more bootstrapping HC archives to support more platforms.
10 --------------------------
11 How to build an HC archive
12 --------------------------
14 It's basically the same as the `Porting Guide
15 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
18 Extract the source archive and duplicate the source tree, one for
19 ``-target`` and one for ``-host``::
21 $ tar jxf ghc-{VERSION}-src.tar.bz2
22 $ cp -r ghc-{VERSION} ghc-{VERSION}-target
23 $ mv ghc-{VERSION} ghc-{VERSION}-host
25 Build some configuration files::
27 $ cd ghc-{VERSION}-target
28 $ ln -s /bin/pwd utils/ghc-pwd/ghc-pwd
29 $ ./configure --enable-hc-boot
30 $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
31 $ gmake bootstrapping-files
34 Run ``./configure`` on the host tree::
36 $ cd ghc-{VERSION}-host
39 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
43 GhcUnregisterised = YES
44 GhcLibHcOpts = -O -fvia-C -keep-hc-files
45 GhcRtsHcOpts = -keep-hc-files
49 GhcWithNativeCodeGen = NO
50 GhcWithInterpreter = NO
52 GhcStage2HcOpts = -O -fvia-C -keep-hc-files
55 utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
57 INTEGER_LIBRARY = integer-simple
63 Create an intermediate tarball::
65 $ rm -f list mkfiles boot.tar.gz
66 $ find . -name "*.hi" >> list
67 $ find . -name "*.hc" >> list
68 $ find . -name "*_stub.c" >> list
69 $ find . -name "*_stub.h" >> list
70 $ find . -name package-data.mk >> list
71 $ find . -name package.conf.d >> list
72 $ find . -name package.conf.inplace >> list
73 $ echo compiler/main/Config.hs >> list
74 $ echo compiler/prelude/primops.txt >> list
75 $ ls compiler/primop-*.hs-incl >> list
76 $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
77 $ find . -name .depend | sed "s/^/touch /" >> mkfiles
78 $ echo mkfiles >> list
79 $ tar -zcf boot.tar.gz -T list
81 Then extract it again, in a different directory::
85 $ tar zxf ../boot.tar.gz
87 Modify hard-coded paths in inplace ``.conf`` files, and then
88 re-archive the HC tree::
90 $ sed -i.bak -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
91 inplace/lib/package.conf.d/*.conf \
95 $ tar jcf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2
97 Done. Upload the archive to some host and add it to the ``Makefile``.