]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - TODO
8e867f9bd57dab3c2e36387beea065209ed429de
[pkgsrc-ghc.git] / TODO
1 .. -*- rst -*-
2
3 ============
4 wip/ghc TODO
5 ============
6
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.
17
18
19 --------------------------
20 How to build an HC archive
21 --------------------------
22
23 It's basically the same as the `Porting Guide
24 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
25 some minor tweaks.
26
27 Extract the source archive and duplicate the source tree, one for
28 ``-target`` and one for ``-host``::
29
30     $ tar jxf ghc-{VERSION}-src.tar.bz2
31     $ cp -r ghc-{VERSION} ghc-{VERSION}-target
32     $ mv ghc-{VERSION} ghc-{VERSION}-host
33
34 Build some configuration files::
35
36     $ cd ghc-{VERSION}-target
37     $ ./configure --enable-hc-boot
38     $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
39     $ gmake bootstrapping-files
40     $ cd ..
41
42 Run ``./configure`` on the host tree::
43
44     $ cd ghc-{VERSION}-host
45     $ ./configure \
46           --with-iconv-includes=/usr/pkg/include \
47           --with-iconv-libraries=/usr/pkg/lib
48
49 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
50 contents::
51
52     PORTING_HOST = YES
53     GhcUnregisterised = YES
54     GhcLibHcOpts = -O -fvia-C -keep-hc-files
55     GhcRtsHcOpts = -keep-hc-files
56     GhcLibWays = v
57     GhcRTSWays =
58     SplitObjs = NO
59     GhcWithNativeCodeGen = NO
60     GhcWithInterpreter = NO
61     GhcStage1HcOpts = -O
62     GhcStage2HcOpts = -O -fvia-C -keep-hc-files
63     SRC_HC_OPTS += -H32m
64     GhcWithSMP = NO
65     utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
66     
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
71
72 Copy some configuration files from the ``-target`` tree::
73
74     $ cp -r ../ghc-{VERSION}-target/includes/dist-{ghcconstants,derivedconstants} includes/
75     $ cp ../ghc-{VERSION}-target/includes/ghcautoconf.h includes/
76
77 Build it::
78
79     $ gmake
80
81 Create an intermediate tarball::
82
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
98
99 Then extract it again, in a different directory::
100
101     $ mkdir ghc-{VERSION}
102     $ cd ghc-{VERSION}
103     $ tar zxf ../boot.tar.gz
104
105 Modify hard-coded paths in inplace ``.conf`` files, and then
106 re-archive the HC tree::
107
108     $ gsed -i \
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
116     $ cd ..
117     $ tar jcvf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
118
119 Done. Upload the archive to some host and add it to the ``Makefile``.