]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - TODO
Merge branch 'ghc-7.4.1'
[pkgsrc-ghc.git] / TODO
1 .. -*- rst -*-
2
3 wip/ghc TODO
4 ============
5
6 * Send hunks #3 and #4 of patch-aclocal.m4 to the upstream.
7 * Send patch-configure.ac to the upstream.
8 * Send patch-libraries-integer-gmp_configure.ac to the upstream.
9 * Send patch-rules_hs-suffix-rules-srcdir.mk to the upstream.
10 * Modify configure.ac and rules/build-package-data.mk to allow
11   ``--with-curses-{includes,libraries}`` to be passed to the top-level
12   ``configure``, and send a patch to the upstream.
13 * Explain about files/bootstrap-main.c and files/capi-wrappers-*.c
14   in this guide, and fix the upstream to throw them away.
15 * Build more bootstrapping HC archives to support more platforms.
16
17
18 How to build an HC archive
19 --------------------------
20
21 A preferred, automated way
22 ^^^^^^^^^^^^^^^^^^^^^^^^^^
23
24 I've written an automation tool to build one: `build-hc-pkg
25 <http://git.cielonegro.org/gitweb.cgi?p=build-hc-pkg.git>`_
26
27 To use it, clone the repository, run ``./build-hc-pkg``, and then
28 follow the instruction it shows::
29
30     $ git clone git://git.cielonegro.org/build-hc-pkg.git
31     ...
32     $ cd build-hc-pkg
33     $ ./build-hc-pkg
34     ...
35     This is build-hc-pkg, running on powerpc-apple-darwin9.8.0 with 2 processors.
36     Enter the file path to ghc-x.y.z-src.tar.bz2: _
37
38 Note that you need Bash, Automake, GNU make, GNU sed, and GNU tar to
39 use it.
40
41
42 A manual way
43 ^^^^^^^^^^^^
44
45 It's basically the same as the `Porting Guide
46 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
47 some minor tweaks.
48
49 Extract the source archive and duplicate the source tree, one for
50 ``-target`` and one for ``-host``::
51
52     $ tar jxf ghc-{VERSION}-src.tar.bz2
53     $ cp -r ghc-{VERSION} ghc-{VERSION}-target
54     $ mv ghc-{VERSION} ghc-{VERSION}-host
55
56 Build some configuration files::
57
58     $ cd ghc-{VERSION}-target
59     $ ./configure --enable-hc-boot
60     $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
61     $ gmake bootstrapping-files
62     $ cd ..
63
64 Run ``./configure`` on the host tree::
65
66     $ cd ghc-{VERSION}-host
67     $ ./configure \
68           --with-iconv-includes=/usr/pkg/include \
69           --with-iconv-libraries=/usr/pkg/lib
70
71 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
72 contents::
73
74     PORTING_HOST = YES
75     GhcUnregisterised = YES
76     GhcLibHcOpts = -O -fvia-C -keep-hc-files
77     GhcRtsHcOpts = -keep-hc-files
78     GhcLibWays = v
79     GhcRTSWays =
80     SplitObjs = NO
81     GhcWithNativeCodeGen = NO
82     GhcWithInterpreter = NO
83     GhcStage1HcOpts = -O
84     GhcStage2HcOpts = -O -fvia-C -keep-hc-files
85     SRC_HC_OPTS += -H32m
86     GhcWithSMP = NO
87     utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
88     
89     INTEGER_LIBRARY = integer-simple
90     libraries/terminfo_CONFIGURE_OPTS += \
91         --configure-option=--with-curses-includes=/usr/pkg/include \
92         --configure-option=--with-curses-libraries=/usr/pkg/lib
93
94 Copy some configuration files from the ``-target`` tree::
95
96     $ cp -r ../ghc-{VERSION}-target/includes/dist-{ghcconstants,derivedconstants} includes/
97     $ cp ../ghc-{VERSION}-target/includes/ghcautoconf.h includes/
98
99 Build it::
100
101     $ gmake
102
103 Create an intermediate tarball::
104
105     $ rm -f list mkfiles boot.tar.gz
106     $ find . -name "*.hi" >> list
107     $ find . -name "*.hc" >> list
108     $ find . -name "*_stub.c" >> list
109     $ find . -name "*_stub.h" >> list
110     $ find . -name package-data.mk >> list
111     $ find . -name package.conf.d >> list
112     $ find . -name package.conf.inplace >> list
113     $ ls compiler/stage?/build/Config.hs >> list
114     $ echo compiler/prelude/primops.txt >> list
115     $ ls compiler/primop-*.hs-incl >> list
116     $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
117     $ find . -name .depend | sed "s/^/touch /" >> mkfiles
118     $ echo mkfiles >> list
119     $ tar -zcf boot.tar.gz -T list
120
121 Then extract it again, in a different directory::
122
123     $ mkdir ghc-{VERSION}
124     $ cd ghc-{VERSION}
125     $ tar zxf ../boot.tar.gz
126
127 Modify hard-coded paths in inplace ``.conf`` files, and then
128 re-archive the HC tree::
129
130     $ gsed -i \
131           -e 's#/usr/pkg#[[PREFIX]]#g' \
132           -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
133           inplace/lib/package.conf.d/*.conf \
134           */package.conf.inplace \
135           */*/package-data.mk \
136           */*/*/package-data.mk \
137           */*/*/*/package-data.mk
138     $ cd ..
139     $ tar jcvf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
140
141 Done. Upload the archive to some host and add it to the ``Makefile``.