|Version 2 (modified by duncan, 5 years ago)|
Guide to the Cabal source code
On first look the Cabal code seems large and intimidating. This page is intended to give you a head start in understanding it.
All the Cabal modules live under Distribution.*
The modules can be roughly divided into to groups, the 'declarative' part and the 'active' part:
- The 'declarative' modules Distribution.* - they are mostly concerned with data structures like package descriptions.
- The 'active' modules Distribution.Simple.* - they are concerned with actually doing things like configuring, building and installing packages.
- Distribution/GetOpt.hs - This should live under Compat/ it's just a bundled version of the standard GetOpt?. Not very interesting.
- Distribution/Setup.hs - This is a deprecated module here just so that old Setup.hs scripts do not break. Ignore it.
- Distribution/Version.hs - exports the Version type along with a parser and pretty printer. A version is something like "1.3.3". It also defines VersionRanges and Dependency data types. Version ranges are like ">= 1.2 && < 2". A dependency is a package name and a version range, like "foo >= 1.2 && < 2".
- Distribution/Package.hs - defines a package identifier along with a parser and pretty printer for it. PackageIdentifiers consist of a name and an exact version (exact as opposed to a dependency like above).
- Distribution/Verbosity.hs - a simple Verbosity type with associated utilities. There are 4 standard verbosity levels from Silent, Normal, Verbose up to Deafening. This is used for deciding what logging messages to print in the active parts.
Useful internal abstractions
Particular phases or actions within the build process
Stuff related to the front end
Command line front ends