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
38 --with-iconv-includes=/usr/pkg/include \
39 --with-iconv-libraries=/usr/pkg/lib
41 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
45 GhcUnregisterised = YES
46 GhcLibHcOpts = -O -fvia-C -keep-hc-files
47 GhcRtsHcOpts = -keep-hc-files
51 GhcWithNativeCodeGen = NO
52 GhcWithInterpreter = NO
54 GhcStage2HcOpts = -O -fvia-C -keep-hc-files
57 utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
59 INTEGER_LIBRARY = integer-simple
60 libraries/terminfo_CONFIGURE_OPTS += \
61 --configure-option=--with-curses-includes=/usr/pkg/include/ncurses \
62 --configure-option=--with-curses-libraries=/usr/pkg/lib
64 Copy some configuration files from the ``-target`` tree::
66 $ cp ../ghc-{VERSION}-target/includes/{ghcautoconf.h,DerivedConstants.h,GHCConstants.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``.