Hadrian is a new build system for the Glasgow Haskell Compiler. It is based on Shake and we hope that it will eventually replace the current
make-based build system. If you are curious about the rationale behind the project and the architecture of the new build system you can find more details in this Haskell Symposium 2016 paper and this Haskell eXchange 2016 talk.
The new build system can work side-by-side with the existing build system. Note, there is some interaction between them: they put (some) build results in the same directories, e.g.
Beware, the build system is in the alpha development phase. Things are shaky and often break; there are numerous Your first buildknown issues. Not afraid? Then put on the helmet and follow these steps:
- If you have never built GHC before, start with the preparation guide.
- This build system is written in Haskell (obviously) and depends on the following Haskell
packages, which need to be installed:
ansi-terminal mtl shake quickcheck.
- Get the sources. It is important for the build system to be in the
hadriandirectory of the GHC source tree:
git clone --recursive git://git.haskell.org/ghc.git cd ghc git clone git://github.com/snowleopard/hadrian
- Build GHC using
hadrian/build.bat(on Windows) instead of
make. You might want to enable parallelism with
-j. We will further refer to the build script simply as
build. If you are interested in building in a Cabal sandbox or using Stack, have a look at
build.stack.shscripts. Also see instructions for building GHC on Windows using Stack. Note, Hadrian runs the
configurescripts automatically on the first build, so that you don't need to. Use
--skip-configureto suppress this behaviour (see overview of command line flags below).
Once your first build is successful, simply run Using the build system
buildto rebuild. Build results are placed into
In addition to standard Shake flags (try Command line flags
--help), the build system currently supports several others:
--flavour=FLAVOUR: choose a build flavour. Two settings are currently supported:
-O0flag to all GHC invocations and disables library profiling, which speeds up builds by 3-4x).
--haddock: build Haddock documentation.
--progress-colour=MODE: choose whether to use colours when printing build progress info. There are three settings:
never(do not use colours),
auto(attempt to detect whether the console supports colours; this is the default setting), and
--progress-info=STYLE: choose how build progress info is printed. There are four settings:
brief(one line per build command),
normal(typically a box per build command; this is the default setting), and
normaljust won't do).
--skip-configure: use this flag to suppress the default behaviour of Hadrian that runs the
configurescripts automatically if need be, so that you don't have to remember to run them manually. With
--skip-configureyou will need to manually run:
./boot ./configure # On Windows run ./configure --enable-tarballs-autodownload
make. Beware, by default Hadrian may do network I/O on Windows to download necessary tarballs, which may sometimes be undesirable;
--skip-configureis your friend in such cases.
--split-objects: generate split objects, which are switched off by default. Due to a GHC bug, you need a full clean rebuild when using this flag.
--verbose: run Hadrian in verbose mode. In particular this prints diagnostic messages by Shake oracles.
The User settings
make-based build system uses
mk/build.mkto specify user build settings. We use
hadrian/UserSettings.hsfor the same purpose, see documentation.
Clean and full rebuild
build cleanremoves all build artefacts.
build -Bforces Shake to rerun all rules, even if the previous build results are are still up-to-date.
To build a GHC source distribution tarball, run Hadrian with the Source distribution
build validateruns GHC tests by simply executing
testsuite/testsdirectory. This can be used instead of
sh validate --fast --no-cleanin the existing build system. Note: this will rebuild Stage2 GHC,
hpcif they are out of date.
build testruns GHC tests by calling the
testsuite/driver/runtests.pypython script with appropriate flags. The current implementation is limited and cannot replace the
validatescript (see #187).
build selftestruns tests of the build system. Current test coverage is close to zero (see #197).
The new build system still lacks many important features: Current limitations
- We only build
- Validation is not implemented: #187.
- Only HTML Haddock documentation is supported (use
- Build flavours and conventional command line flags are not implemented: #188.
- Cross-compilation is not implemented: #177.
- There is no support for installation or binary distribution: #219.
Check out milestones to see when we hope to resolve the above limitations.