Changes between Version 57 and Version 58 of Building/Hacking


Ignore:
Timestamp:
Sep 5, 2015 2:12:43 PM (4 years ago)
Author:
thomie
Comment:

Delete everything

Legend:

Unmodified
Added
Removed
Modified
  • Building/Hacking

    v57 v58  
    1 
    2 [[PageOutline]]
    3 
    4 = Quick Start to using the build system as a developer =
    5 
    6 This page gives a quick overview of how to get around the GHC build system as a developer. There is more complete documentation for the build system later on in this guide (see [wiki:Building/Using Comprehensive overview of using the build system]). If you are not looking to hack on GHC at all, but just want to build and install GHC, head on over to [wiki:Building/QuickStart Quick Start to just building and installing GHC].
    7 
    8 == Before starting your build ==
    9 
    10 You need to configure your build: which things to build, how much optimisation to use, whether to build profiling libraries, and so on.  If you don't do this, then you get ''everything'', and it will be ''optimised to the hilt'', which means the build will take a Very Long Time.  This is fine if you wanted to build GHC for installation and use, but not if you're building GHC to do some development work on it.
    11 
    12 To configure your build, create the file {{{mk/build.mk}}} from the sample:
    13 
    14 {{{
    15 $ cp mk/build.mk.sample mk/build.mk
    16 }}}
    17 
    18 and then edit {{{mk/build.mk}}} to select the build you want.  If you're not sure what you
    19 want, just uncommenting this line
    20 
    21 {{{
    22 #BuildFlavour = devel2
    23 }}}
    24 
    25 is usually a good choice.  For more information on what you can do with `build.mk`, see [wiki:Building/Using#Buildconfiguration Build configuration].  In particular, you might want to [wiki:Building/Using#HowtomakeGHCbuildquickly make GHC build quickly].
    26 
    27 == Starting the build ==
    28 
    29 To build the whole thing (compiler, libraries, compiler again), do this:
    30 
    31 {{{
    32 $ ./boot
    33 $ ./configure
    34 # NOTE: On Windows you need to download some binary distributables before being able to build
    35 # This only has to be done once and can be done by adding a flag to the call to configure:
    36 # ./configure --enable-tarballs-autodownload
    37 $ make
    38 }}}
    39 
    40 There are more configuration settings that you can use when running the configure script, see [wiki:Building/Using#Runtheconfigurescript Run the configure script].
    41 
    42 assuming everything goes according to plan, this should leave you with a compiler that you can run: {{{inplace/bin/ghc-stage2}}}.
    43 
    44 == Building after making changes ==
    45 
    46 To bring the whole tree up to date after making a change, just
    47 
    48 {{{
    49 $ make
    50 }}}
    51 
    52 it might take a while, depending on what you changed.  If you want to rebuild just part of the tree, for example the RTS, go into the appropriate subdirectory and say `make` there:
    53 
    54 {{{
    55 $ cd rts
    56 $ make
    57 }}}
    58 
    59 this should rebuild just the RTS.  If you want to just build the stage 2 compiler, then
    60 
    61 {{{
    62 $ cd ghc
    63 $ make 2
    64 }}}
    65 
    66 For more, see [wiki:Building/Using#DevelopinginaGHCbuildtree Developing in a GHC build tree].
    67 
    68 == Cleaning ==
    69 
    70 To clean the whole tree:
    71 
    72 {{{
    73 $ make clean
    74 }}}
    75 
    76 there's also `make distclean`, which will clean files that are generated by `configure`, and `make maintainer-clean`, which cleans everything that is not in the source repository.
    77 
    78 You can clean just a part of the tree, e.g. the RTS:
    79 
    80 {{{
    81 $ cd rts
    82 $ make clean
    83 }}}
    84 
    85 == Testing ==
    86 
    87 The [wiki:TestingPatches validation script] does a build of GHC from scratch and runs the [wiki:Building/RunningTests test suite]. If it passes without any errors, then it is ok to submit the patches from your tree. You should of course either be [wiki:Building/RunningTests/Adding adding] onto the test suite or [wiki:Building/RunningTests/Running running] manual tests to verify your changes.
    88 
    89 == Parallel builds ==
    90 
    91 The GHC build system works with make's `-j` flag, which spawns multiple compile processes in parallel.  Even on a single processor machine it's usually worthwhile using at least `make -j2`, because the I/O will be overlapped with compute-intensive compilation.  On a multicore machine, higher `-j` values will speed up the build even more.
    92 
    93 == Running GHC from the build tree ==
    94 
    95 You don't need to install GHC to use it.  After the build has completed, you can run GHC like this:
    96 
    97 {{{
    98 $ ./inplace/bin/ghc-stage2
    99 }}}
    100 
    101 and to start GHCi, just add the `--interactive` flag.  You can also see what packages have been built:
    102 
    103 {{{
    104 $ ./inplace/bin/ghc-pkg list
    105 }}}
     1This page has been merged with [wiki:Newcomers]. Please update your links.