Ok, so now we know its possible! Now the question is how to create and use a 
_registered_ hc file bundle.
The Build manual describes the process of cross compiling an _unregistered_ hc 
file bundle, but has nothing to say about creating the simpler registered hc 
file bundle for the purpose of bootstrapping GHC on an equivalent supported 
platform but without a preinstalled ghc.

So, reading between the lines a little, here is what I propose trying. Please 
take a look, and give me your thoughts if you think I am on the wrong track!

HOST: Has ghc, happy, alex installed.
TARGET: Same as host, but without ghc, happy alex.

On the HOST
-----------------

Unpack src tree, and cd into it.

Configure with necessary options
        $ ./configure --prefix=...

Section 10.2.1'Cross-compiling to produce an unregisterised GHC' in the build 
manual suggests creating an mk/build.mk with following contents:
        GhcUnregisterised = YES
        GhcLibHcOpts = -O -fvia-C -keep-hc-files
        GhcRtsHcOpts = -keep-hc-files
        GhcLibWays =
        SplitObjs = NO
        GhcWithNativeCodeGen = NO
        GhcWithInterpreter = NO
        GhcStage1HcOpts = -O
        GhcStage2HcOpts = -O -fvia-C -keep-hc-files
        SRC_HC_OPTS += -H32m
        GhcBootLibs = YES
Reading between the lines somewhat, for a full registered version we might 
need something like
        GhcUnregisterised = NO
        GhcLibHcOpts = -O -fvia-C -keep-hc-files
        GhcRtsHcOpts = -keep-hc-files
        GhcLibWays =
        SplitObjs = NO
        GhcWithNativeCodeGen = YES
        GhcWithInterpreter = YES
        GhcStage1HcOpts = -O
        GhcStage2HcOpts = -O -fvia-C -keep-hc-files
        SRC_HC_OPTS += -H32m
        GhcBootLibs = YES
Advice on this bit gratefully received!

The manual next suggests copying some target generated include files into the 
host ghc source, but since they are the same I guess we can ignore that bit.

Now building exactly as described in the manual:

        $ pushd glafp-utils && make boot && make && popd
        $ pushd ghc && make boot && make && popd

Manual suggests the build might fail in RTS, but probably not for our 
registered version ?

        $ pushd libraries && make boot && make && popd
        $ pushd ghc/compiler && make boot stage=2 && make stage=2 && popd

        $ pushd ghc/lib/compat
        $ make clean
        $ rm .depend
        $ make boot UseStage1=YES
        $ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'
        $ popd
        $ pushd ghc/utils
        $ make clean
        $ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'
        $ popd
        $ make hc-file-bundle Project=Ghc

That should provide us with our hc-file-bundle, *-hc.tar.gz

On the TARGET
--------------------

Unpack src tree, unpack the hc file bundle on top of it.
Cd into the src tree.

Now it should be a simple matter of
        $ distrib/hc-build --prefix=dir
        $ make install

Any comments/suggestions before I give it a try?

Thanks for all help so far, and in anticipation of more!

Andrew Walrond
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to