|
|
# GHC Commentary: Libraries
|
|
|
|
|
|
|
|
|
All GHC installations contain a set of libraries called the **boot packages**. They are so called because the boot packages are the ones required for GHC to compile itself (the stage-2 compiler).
|
|
|
All GHC build trees contain a set of libraries, called the **Boot Packages**. These are the libraries that GHC's source code imports. Obviously you need the boot packages to build GHC at all (whether the stage-1 or stage-2 compiler).
|
|
|
|
|
|
|
|
|
The boot packages, along with the other subcomponents of the GHC build system, are in the file `packages` in a GHC tree. To get a list of them, you can run `make show VALUE=PACKAGES` in a configured GHC build tree. (This variable is set in `$(TOP)/ghc.mk`.)
|
|
|
The Boot Packages, along with the other subcomponents of the GHC build system, are in the file `packages` in a GHC tree. To get a list of them, you can run `make show VALUE=PACKAGES` in a configured GHC build tree. (This variable is set in `$(TOP)/ghc.mk`.)
|
|
|
|
|
|
|
|
|
Every installation of GHC includes the Boot Packages.
|
|
|
|
|
|
## Zero-boot packages
|
|
|
|
|
|
|
|
|
The **Zero-boot Packages** are a small subset of the boot packages. Since GHC's source code imports the boot packages, *even the bootstrap compiler must have the boot packages available*. But for certain fast-moving boot packages (eg Cabal), we don't want to rely on the user having installed a bang-up-to-date version of the package. So we begin the entire build process by installing the zero-boot packages in the bootstrap compiler. (This installation is purely local to the build tree.) The bootstrap compiler is expected to have all other (non-zero-) boot packages already installed.
|
|
|
|
|
|
|
|
|
As time goes on, a Zero-boot package may become an ordinary boot package, because the bootstrap compiler is expected to have (a sufficiently up to date) version of the package already.
|
|
|
|
|
|
|
|
|
The current Zero-boot packages are:
|
|
|
|
|
|
- `Cabal`: we frequently update Cabal and GHC in sync
|
|
|
- `filepath`
|
|
|
|
|
|
## Classifying the boot packages
|
|
|
|
|
|
|
|
|
A second important classification of the boot packages is as follows:
|
|
|
|
|
|
- **INDEPENDENT**: Independently maintained (e.g. time, haskeline)
|
|
|
- **COUPLED**: Tightly coupled to GHC, but used by others (base)
|
|
|
- **SPECIFIC**: Totally specific to GHC (e.g. template-haskell, DPH)
|
|
|
|
|
|
|
|
|
Most boot libraries are INDEPENDENT. INDEPENDENT libraries have a
|
|
|
master repository somewhere separate from the GHC repositories. Whenever we release GHC, we ensure that the INDEPENDENT boot libraries that come with GHC are precisely sync'd with a particular released version of that library.
|
|
|
|
|
|
|
|
|
The current classification of packages is:
|
|
|
|
|
|
- SPECIFIC: `ghc-prim`, `template-haskell`, `DPH`
|
|
|
- COUPLED: `base`
|
|
|
- INDEPENDENT: all other packages
|
|
|
|
|
|
## Boot packages dependencies
|
|
|
|
|
|
- At the root of the hierarchy we have **`ghc-prim`**. As the name implies, this package contains the most primitive types and functions. It only contains a handful of modules, including `GHC.Prim` (which contains `Int#`, `+#`, etc) and `GHC.Bool`, containing the `Bool` datatype.
|
|
|
|
... | ... | |