Building the Glasgow Functional Programming Tools Suite

The GHC Team

Abstract

The Glasgow fptools suite is a collection of Functional Programming related tools, including the Glasgow Haskell Compiler (GHC). The source code for the whole suite is kept in a single CVS repository and shares a common build and installation system.

This guide is intended for people who want to build or modify programs from the Glasgow fptools suite (as distinct from those who merely want to run them). Installation instructions are now provided in the user guide.

The bulk of this guide applies to building on Unix systems; see Section 13, “Instructions for building under Windows” for Windows notes.


Table of Contents

1. Getting the sources
2. Using the CVS repository
2.1. Getting access to the CVS Repository
2.1.1. Remote Read-only CVS Access
2.1.2. Remote Read-Write CVS Access
2.2. Checking Out a Source Tree
2.3. Committing Changes
2.4. Updating Your Source Tree
2.5. GHC Tag Policy
2.6. General Hints
3. What projects are there?
4. Things to check before you start
5. What machines the Glasgow tools run on
5.1. What platforms the Haskell compiler (GHC) runs on
5.2. What machines the other tools run on
6. Installing pre-supposed utilities
6.1. Tools for building parallel GHC (GPH)
6.2. Other useful tools
7. Building from source
7.1. Quick Start
7.2. Your source tree
7.3. Build trees
7.4. Getting the build you want
7.5. The story so far
7.6. Making things
7.7. Bootstrapping GHC
7.8. Standard Targets
7.9. Using a project from the build tree
7.10. Fast Making
8. The Makefile architecture
8.1. Debugging
8.2. A small project
8.3. A larger project
8.4. Boilerplate architecture
8.5. The main mk/boilerplate.mk file
8.6. Platform settings
8.7. Pattern rules and options
8.8. The main mk/target.mk file
8.9. Recursion
8.10. Way management
8.11. When the canned rule isn't right
9. Building the documentation
9.1. Tools for building the Documentation
9.2. Installing the DocBook tools
9.2.1. Installing the DocBook tools on Linux
9.2.2. Installing DocBook on FreeBSD
9.2.3. Installing from binaries on Windows
9.3. Configuring the DocBook tools
9.4. Building the documentation
9.5. Installing the documentation
10. Porting GHC
10.1. Booting/porting from C (.hc) files
10.2. Porting GHC to a new architecture
10.2.1. Cross-compiling to produce an unregisterised GHC
10.2.2. Porting the RTS
10.2.3. The mangler
10.2.4. The splitter
10.2.5. The native code generator
10.2.6. GHCi
11. Known pitfalls in building Glasgow Haskell
12. Platforms, scripts, and file names
12.1. Windows platforms: Cygwin, MSYS, and MinGW
12.1.1. MinGW
12.1.2. Cygwin and MSYS
12.1.3. Targeting MinGW
12.1.4. File names
12.1.5. Crippled ld
12.1.6. Host System vs Target System
12.2. Wrapper scripts
13. Instructions for building under Windows
13.1. Installing and configuring MSYS
13.2. Installing and configuring Cygwin
13.3. Configuring SSH
13.4. Other things you need to install
13.5. Building GHC
Index

1. Getting the sources

You can get your hands on the fptools in two ways:

Source distributions

You have a supported platform, but (a) you like the warm fuzzy feeling of compiling things yourself; (b) you want to build something ``extra”—e.g., a set of libraries with strictness-analysis turned off; or (c) you want to hack on GHC yourself.

A source distribution contains complete sources for one or more projects in the fptools suite. Not only that, but the more awkward machine-independent steps are done for you. For example, if you don't have happy you'll find it convenient that the source distribution contains the result of running happy on the parser specifications. If you don't want to alter the parser then this saves you having to find and install happy. You will still need a working version of GHC (version 5.x or later) on your machine in order to compile (most of) the sources, however.

The CVS repository.

We make releases infrequently. If you want more up-to-the minute (but less tested) source code then you need to get access to our CVS repository.

All the fptools source code is held in a CVS repository. CVS is a pretty good source-code control system, and best of all it works over the network.

The repository holds source code only. It holds no mechanically generated files at all. So if you check out a source tree from CVS you will need to install every utility so that you can build all the derived files from scratch.

More information about our CVS repository can be found in Section 2, “Using the CVS repository”.

If you are going to do any building from sources (either from a source distribution or the CVS repository) then you need to read all of this manual in detail.