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