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 $ ./configure --enable-hc-boot
29 $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
30 $ gmake bootstrapping-files
33 Run ``./configure`` on the host tree::
35 $ cd ghc-{VERSION}-host
37 --with-iconv-includes=/usr/pkg/include \
38 --with-iconv-libraries=/usr/pkg/lib
40 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
44 GhcUnregisterised = YES
45 GhcLibHcOpts = -O -fvia-C -keep-hc-files
46 GhcRtsHcOpts = -keep-hc-files
50 GhcWithNativeCodeGen = NO
51 GhcWithInterpreter = NO
53 GhcStage2HcOpts = -O -fvia-C -keep-hc-files
56 utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
58 INTEGER_LIBRARY = integer-simple
59 libraries/terminfo_CONFIGURE_OPTS += \
60 --configure-option=--with-curses-includes=/usr/pkg/include \
61 --configure-option=--with-curses-libraries=/usr/pkg/lib
63 Copy some configuration files from the ``-target`` tree::
65 $ cp -r ../ghc-{VERSION}-target/includes/dist-{ghcconstants,derivedconstants} includes/
66 $ cp ../ghc-{VERSION}-target/includes/ghcautoconf.h includes/
72 Create an intermediate tarball::
74 $ rm -f list mkfiles boot.tar.gz
75 $ find . -name "*.hi" >> list
76 $ find . -name "*.hc" >> list
77 $ find . -name "*_stub.c" >> list
78 $ find . -name "*_stub.h" >> list
79 $ find . -name package-data.mk >> list
80 $ find . -name package.conf.d >> list
81 $ find . -name package.conf.inplace >> list
82 $ ls compiler/stage?/build/Config.hs >> list
83 $ echo compiler/prelude/primops.txt >> list
84 $ ls compiler/primop-*.hs-incl >> list
85 $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
86 $ find . -name .depend | sed "s/^/touch /" >> mkfiles
87 $ echo mkfiles >> list
88 $ tar -zcf boot.tar.gz -T list
90 Then extract it again, in a different directory::
94 $ tar zxf ../boot.tar.gz
96 Modify hard-coded paths in inplace ``.conf`` files, and then
97 re-archive the HC tree::
100 -e 's#/usr/pkg#[[PREFIX]]#g' \
101 -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
102 inplace/lib/package.conf.d/*.conf \
103 */*/package-data.mk \
104 */*/*/package-data.mk
106 $ tar jcf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
108 Done. Upload the archive to some host and add it to the ``Makefile``.