Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
6083 commits behind the upstream repository.
  • Matthew Pickering's avatar
    fe23629b
    hadrian: Add reloc-binary-dist-* targets · fe23629b
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    This adds a command line option to build a "relocatable" bindist.
    
    The bindist is created by first creating a normal bindist and then
    installing it using the `RelocatableBuild=YES` option. This creates a
    bindist without any wrapper scripts pointing to the libdir.
    
    The motivation for this feature is that we want to ship relocatable
    bindists on windows and this method is more uniform than the ad-hoc
    method which lead to bugs such as #23608 and #23476
    
    The relocatable bindist can be built with the "reloc-binary-dist" target
    and supports the same suffixes as the normal "binary-dist" command to
    specify the compression style.
    fe23629b
    History
    hadrian: Add reloc-binary-dist-* targets
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    This adds a command line option to build a "relocatable" bindist.
    
    The bindist is created by first creating a normal bindist and then
    installing it using the `RelocatableBuild=YES` option. This creates a
    bindist without any wrapper scripts pointing to the libdir.
    
    The motivation for this feature is that we want to ship relocatable
    bindists on windows and this method is more uniform than the ad-hoc
    method which lead to bugs such as #23608 and #23476
    
    The relocatable bindist can be built with the "reloc-binary-dist" target
    and supports the same suffixes as the normal "binary-dist" command to
    specify the compression style.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 15.46 KiB

Hadrian

Hadrian is the build system for the Glasgow Haskell Compiler. It is based on the Shake library. If you are curious about the rationale behind the project and the architecture of the build system you can find more details in this Haskell Symposium 2016 paper and this Haskell eXchange 2016 talk.

Your first build

Put on the helmet and run the following commands from the root of the GHC tree:

./boot && ./configure
hadrian/build -j

or on Windows:

./boot && ./configure --enable-tarballs-autodownload
hadrian/build.bat -j

Here flag -j enables parallelism and is optional. We will further refer to the build script simply as build.

  • On Windows, if you do not want to install MSYS, you can use the Stack-based build script (Stack provides a managed MSYS environment), as described in these instructions. If you don't mind installing MSYS yourself or already have it, you can use the Cabal-based build script.

  • Hadrian is written in Haskell and depends on shake (plus a few packages that shake depends on), mtl, quickcheck, and GHC core libraries.

  • If you have never built GHC before, start with the preparation guide.

  • By default Hadrian will fetch dependencies from the internet. If this is a problem for your build system then see the bootstrap directory for instructions about how to build hadrian without an internet connection.

Using the build system

Once your first build is successful, simply run build to rebuild after some changes. Build results are placed into _build by default.

Choosing a build flavour

There are many different ways to build a compiler, each way is called a flavour.

  • --flavour=FLAVOUR: choose a build flavour. The following settings are currently supported: default, quick, quickest, perf, prof, devel1 and devel2. As an example, the quickest flavour adds -O0 flag to all GHC invocations and builds libraries only in the vanilla way, which speeds up builds by 3-4x.

In addition to the overall build flavour there are also "flavour transformers" which can slightly modify the build settings for a flavour. Some common flavour transformers are:

  • no_profiled_libs: Don't build profiled libraries
  • lint: Build with core lint enabled.
  • etc

A flavour transformer is appended to a normal flavour name using +

--flavour=default+lint

Build flavours and flavour transformers are documented here.

Command line flags