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.
19 --------------------------
20 How to build an HC archive
21 --------------------------
23 It's basically the same as the `Porting Guide
24 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
27 Extract the source archive and duplicate the source tree, one for
28 ``-target`` and one for ``-host``::
30 $ tar jxf ghc-{VERSION}-src.tar.bz2
31 $ cp -r ghc-{VERSION} ghc-{VERSION}-target
32 $ mv ghc-{VERSION} ghc-{VERSION}-host
34 Build some configuration files::
36 $ cd ghc-{VERSION}-target
37 $ ./configure --enable-hc-boot
38 $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
39 $ gmake bootstrapping-files
42 Run ``./configure`` on the host tree::
44 $ cd ghc-{VERSION}-host
46 --with-iconv-includes=/usr/pkg/include \
47 --with-iconv-libraries=/usr/pkg/lib
49 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
53 GhcUnregisterised = YES
54 GhcLibHcOpts = -O -fvia-C -keep-hc-files
55 GhcRtsHcOpts = -keep-hc-files
59 GhcWithNativeCodeGen = NO
60 GhcWithInterpreter = NO
62 GhcStage2HcOpts = -O -fvia-C -keep-hc-files
65 utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
67 INTEGER_LIBRARY = integer-simple
68 libraries/terminfo_CONFIGURE_OPTS += \
69 --configure-option=--with-curses-includes=/usr/pkg/include \
70 --configure-option=--with-curses-libraries=/usr/pkg/lib
72 Copy some configuration files from the ``-target`` tree::
74 $ cp -r ../ghc-{VERSION}-target/includes/dist-{ghcconstants,derivedconstants} includes/
75 $ cp ../ghc-{VERSION}-target/includes/ghcautoconf.h includes/
81 Create an intermediate tarball::
83 $ rm -f list mkfiles boot.tar.gz
84 $ find . -name "*.hi" >> list
85 $ find . -name "*.hc" >> list
86 $ find . -name "*_stub.c" >> list
87 $ find . -name "*_stub.h" >> list
88 $ find . -name package-data.mk >> list
89 $ find . -name package.conf.d >> list
90 $ find . -name package.conf.inplace >> list
91 $ ls compiler/stage?/build/Config.hs >> list
92 $ echo compiler/prelude/primops.txt >> list
93 $ ls compiler/primop-*.hs-incl >> list
94 $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
95 $ find . -name .depend | sed "s/^/touch /" >> mkfiles
96 $ echo mkfiles >> list
97 $ tar -zcf boot.tar.gz -T list
99 Then extract it again, in a different directory::
101 $ mkdir ghc-{VERSION}
103 $ tar zxf ../boot.tar.gz
105 Modify hard-coded paths in inplace ``.conf`` files, and then
106 re-archive the HC tree::
109 -e 's#/usr/pkg#[[PREFIX]]#g' \
110 -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
111 inplace/lib/package.conf.d/*.conf \
112 */package.conf.inplace \
113 */*/package-data.mk \
114 */*/*/package-data.mk \
115 */*/*/*/package-data.mk
117 $ tar jcvf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
119 Done. Upload the archive to some host and add it to the ``Makefile``.