7 * Send hunks #3 and #4 of patch-aclocal.m4 to the upstream.
8 * Send patch-configure.ac to the upstream.
9 * Send patch-libraries-integer-gmp_configure.ac to the upstream.
10 * Send patch-rules_hs-suffix-rules-srcdir.mk to the upstream.
11 * Modify configure.ac and rules/build-package-data.mk to allow
12 ``--with-curses-{includes,libraries}`` to be passed to the top-level
13 ``configure``, and send a patch to the upstream.
14 * Explain about files/bootstrap-main.c and files/capi-wrappers-*.c
15 in this guide, and fix the upstream to throw them away.
16 * Build more bootstrapping HC archives to support more platforms.
18 How to build an HC archive
19 --------------------------
21 It's basically the same as the `Porting Guide
22 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
25 Extract the source archive and duplicate the source tree, one for
26 ``-target`` and one for ``-host``::
28 $ tar jxf ghc-{VERSION}-src.tar.bz2
29 $ cp -r ghc-{VERSION} ghc-{VERSION}-target
30 $ mv ghc-{VERSION} ghc-{VERSION}-host
32 Build some configuration files::
34 $ cd ghc-{VERSION}-target
35 $ ./configure --enable-hc-boot
36 $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
37 $ gmake bootstrapping-files
40 Run ``./configure`` on the host tree::
42 $ cd ghc-{VERSION}-host
44 --with-iconv-includes=/usr/pkg/include \
45 --with-iconv-libraries=/usr/pkg/lib
47 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
51 GhcUnregisterised = YES
52 GhcLibHcOpts = -O -fvia-C -keep-hc-files
53 GhcRtsHcOpts = -keep-hc-files
57 GhcWithNativeCodeGen = NO
58 GhcWithInterpreter = NO
60 GhcStage2HcOpts = -O -fvia-C -keep-hc-files
63 utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
65 INTEGER_LIBRARY = integer-simple
66 libraries/terminfo_CONFIGURE_OPTS += \
67 --configure-option=--with-curses-includes=/usr/pkg/include \
68 --configure-option=--with-curses-libraries=/usr/pkg/lib
70 Copy some configuration files from the ``-target`` tree::
72 $ cp -r ../ghc-{VERSION}-target/includes/dist-{ghcconstants,derivedconstants} includes/
73 $ cp ../ghc-{VERSION}-target/includes/ghcautoconf.h includes/
79 Create an intermediate tarball::
81 $ rm -f list mkfiles boot.tar.gz
82 $ find . -name "*.hi" >> list
83 $ find . -name "*.hc" >> list
84 $ find . -name "*_stub.c" >> list
85 $ find . -name "*_stub.h" >> list
86 $ find . -name package-data.mk >> list
87 $ find . -name package.conf.d >> list
88 $ find . -name package.conf.inplace >> list
89 $ ls compiler/stage?/build/Config.hs >> list
90 $ echo compiler/prelude/primops.txt >> list
91 $ ls compiler/primop-*.hs-incl >> list
92 $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
93 $ find . -name .depend | sed "s/^/touch /" >> mkfiles
94 $ echo mkfiles >> list
95 $ tar -zcf boot.tar.gz -T list
97 Then extract it again, in a different directory::
101 $ tar zxf ../boot.tar.gz
103 Modify hard-coded paths in inplace ``.conf`` files, and then
104 re-archive the HC tree::
107 -e 's#/usr/pkg#[[PREFIX]]#g' \
108 -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
109 inplace/lib/package.conf.d/*.conf \
110 */package.conf.inplace \
111 */*/package-data.mk \
112 */*/*/package-data.mk \
113 */*/*/*/package-data.mk
115 $ tar jcvf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
117 Done. Upload the archive to some host and add it to the ``Makefile``.