]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - TODO
cc117ccb6b3d5895b7d8824107131a95872c0acf
[pkgsrc-ghc.git] / TODO
1 .. -*- rst -*-
2
3 ============
4 wip/ghc TODO
5 ============
6
7 * Build more bootstrapping HC archives to support more platforms.
8
9
10 --------------------------
11 How to build an HC archive
12 --------------------------
13
14 It's basically the same as the `Porting Guide
15 <http://hackage.haskell.org/trac/ghc/wiki/Building/Porting>`_, plus
16 some minor tweaks.
17
18 Extract the source archive and duplicate the source tree, one for
19 ``-target`` and one for ``-host``::
20
21     $ tar jxf ghc-{VERSION}-src.tar.bz2
22     $ cp -r ghc-{VERSION} ghc-{VERSION}-target
23     $ mv ghc-{VERSION} ghc-{VERSION}-host
24
25 Build some configuration files::
26
27     $ cd ghc-{VERSION}-target
28     $ ln -s /bin/pwd utils/ghc-pwd/ghc-pwd
29     $ ./configure --enable-hc-boot
30     $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk
31     $ gmake bootstrapping-files
32     $ cd ..
33
34 Run ``./configure`` on the host tree::
35
36     $ cd ghc-{VERSION}-host
37     $ ./configure \
38           --with-iconv-includes=/usr/pkg/include \
39           --with-iconv-libraries=/usr/pkg/lib
40
41 Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following
42 contents::
43
44     PORTING_HOST = YES
45     GhcUnregisterised = YES
46     GhcLibHcOpts = -O -fvia-C -keep-hc-files
47     GhcRtsHcOpts = -keep-hc-files
48     GhcLibWays = v
49     GhcRTSWays =
50     SplitObjs = NO
51     GhcWithNativeCodeGen = NO
52     GhcWithInterpreter = NO
53     GhcStage1HcOpts = -O
54     GhcStage2HcOpts = -O -fvia-C -keep-hc-files
55     SRC_HC_OPTS += -H32m
56     GhcWithSMP = NO
57     utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files
58     
59     INTEGER_LIBRARY = integer-simple
60     libraries/terminfo_CONFIGURE_OPTS += \
61         --configure-option=--with-curses-includes=/usr/pkg/include \
62         --configure-option=--with-curses-libraries=/usr/pkg/lib
63
64 Copy some configuration files from the ``-target`` tree::
65
66     $ cp ../ghc-{VERSION}-target/includes/{ghcautoconf.h,DerivedConstants.h,GHCConstants.h} includes/
67
68 Build it::
69
70     $ gmake
71
72 Create an intermediate tarball::
73
74     $ rm -f list mkfiles boot.tar.gz
75     $ find . -name "*.hi" >> list
76     $ find . -name "*.hc" >> list
77     $ find . -name "*_stub.c" >> list
78     $ find . -name "*_stub.h" >> list
79     $ find . -name package-data.mk >> list
80     $ find . -name package.conf.d >> list
81     $ find . -name package.conf.inplace >> list
82     $ ls compiler/stage?/build/Config.hs >> list
83     $ echo compiler/prelude/primops.txt >> list
84     $ ls compiler/primop-*.hs-incl >> list
85     $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
86     $ find . -name .depend | sed "s/^/touch /" >> mkfiles
87     $ echo mkfiles >> list
88     $ tar -zcf boot.tar.gz -T list
89
90 Then extract it again, in a different directory::
91
92     $ mkdir ghc-{VERSION}
93     $ cd ghc-{VERSION}
94     $ tar zxf ../boot.tar.gz
95
96 Modify hard-coded paths in inplace ``.conf`` files, and then
97 re-archive the HC tree::
98
99     $ gsed -i.bak \
100           -e 's#/usr/pkg#[[PREFIX]]#g' \
101           -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \
102           inplace/lib/package.conf.d/*.conf \
103           */*/package-data.mk \
104           */*/*/package-data.mk
105     $ cd ..
106     $ tar jcf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 ghc-{VERSION}
107
108 Done. Upload the archive to some host and add it to the ``Makefile``.