Changes between Version 32 and Version 33 of Building/Porting


Ignore:
Timestamp:
May 22, 2009 11:52:04 AM (5 years ago)
Author:
igloo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Building/Porting

    v32 v33  
    22 
    33 
    4 = Porting GHC = 
    5  
    6 This section describes how to port GHC to a currenly 
     4= Porting GHC to a new platform = 
     5 
     6'''NOTE''': Versions supported: 6.11+. 
     7 
     8This section describes how to port GHC to a currently 
    79unsupported platform.  To avoid confusion, when we say 
    810"architecture" we are referring to the processor, and 
    911we use the term "platform" to refer to the combination 
    1012of architecture and operating system. 
    11  
    12 There are two distinct porting scenarios: 
    13  
    14  * Your platform is already supported, but you want to compile up GHC 
    15    using just a C compiler.  This is a straightforward bootstrap from HC 
    16    files, and is described in the next section. 
    17  
    18  * Your platform isn't supported by GHC.  You will need to do an 
    19    ''unregisterised bootstrap'', proceed to 
    20    [[ref(Porting GHC to a new platform)]]. 
    21  
    22 == Booting/porting from C ({{{.hc}}}) files == 
    23  
    24 Bootstrapping GHC on a system without GHC already installed is 
    25 achieved by taking the intermediate C files (known as HC files) from 
    26 another GHC compilation, compiling them using gcc to get a working 
    27 GHC. 
    28  
    29 '''NOTE''': Versions supported: between 6.0.1 and 6.6.2.  We are working 
    30 on getting bootstrapping working again in the 6.8 series, see #1346. 
    31  
    32 HC files are platform-dependent, so you have to get a set that were 
    33 generated on ''the same platform''.  There may be some supplied on the 
    34 GHC download page, otherwise you'll have to compile some up yourself. 
    35  
    36 The following steps should result in a working GHC build with full 
    37 libraries: 
    38  
    39  * Make a set of HC files.  On an identical system with GHC already 
    40    installed, get a GHC source tree and put the following in 
    41    {{{mk/build.mk}}}: 
    42 {{{ 
    43 SRC_HC_OPTS     = -H32m -O -fvia-C -Rghc-timing -keep-hc-files 
    44 GhcLibHcOpts    = -O 
    45 GhcLibWays      = 
    46 SplitObjs       = NO 
    47 }}} 
    48    Build GHC as normal, and then {{{make hc-file-bundle Project=ghc}}} 
    49    to creates the tar file containing the hc files. 
    50  
    51  * On the target system, unpack the HC files on top of a fresh source 
    52    tree (make sure the source tree version matches the version of the 
    53    HC files ''exactly''!).  This will place matching {{{.hc}}} files 
    54    next to the corresponding Haskell source ({{{.hs}}} or {{{.lhs}}}) 
    55    in the compiler subdirectory {{{ghc/compiler}}} and in the 
    56    libraries (subdirectories of {{{libraries}}}). 
    57  
    58  * The actual build process is fully automated by the [[GhcFile(distrib/hc-build)]] 
    59    script.  If you eventually 
    60    want to install GHC into the directory 
    61    `<dir>`, the following command will execute 
    62    the whole build process (it won't install yet): 
    63 {{{ 
    64 $ distrib/hc-build --prefix=<dir> 
    65 }}} 
    66    By default, the installation directory is {{{/usr/local}}}.  If 
    67    that is what you want, you may omit the argument to {{{hc-build}}}. 
    68    Generally, any option given to {{{hc-build}}} is passed through to 
    69    the configuration script {{{configure}}}.  If {{{hc-build}}} 
    70    successfully completes the build process, you can install the 
    71    resulting system, as normal, with 
    72 {{{ 
    73 $ make install 
    74 }}} 
    75  
    76  
    77 == Porting GHC to a new platform == 
    78  
    79 '''NOTE''': Versions supported: 6.11+. 
    8013 
    8114The first step in porting to a new platform is to get an 
     
    10235code which needs tweaking for your system. 
    10336 
    104 === Cross-compiling to produce an unregisterised GHC === 
     37== Cross-compiling to produce an unregisterised GHC == 
    10538 
    10639NOTE! These instructions apply to GHC 6.11 and (hopefully) later. 
     
    311244tweaks in order to get a registerised build going. 
    312245 
    313 === Porting the RTS === 
     246== Porting the RTS == 
    314247 
    315248The following files need architecture-specific code for a registerised 
     
    347280  your OS. 
    348281 
    349 === The mangler === 
     282== The mangler == 
    350283 
    351284The mangler is an evil Perl-script 
     
    360293your platform. 
    361294 
    362 === The splitter === 
     295== The splitter == 
    363296 
    364297The splitter is another evil Perl script 
     
    373306it for your system. 
    374307 
    375 === The native code generator === 
     308== The native code generator == 
    376309 
    377310The native code generator isn't essential to getting a 
     
    380313generator is described in detail in [wiki:Commentary/Compiler/Backends/NCG]. 
    381314 
    382 === GHCi === 
     315== GHCi == 
    383316 
    384317To support GHCi, you need to port the dynamic linker