88
99Stack supports building the GHC compiler from source, using
1010[ Hadrian] ( https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/README.md ) (the
11- build system for GHC). The GHC version to build and to use is defined by a a Git
11+ build system for GHC). The GHC version to build and to use is defined by a Git
1212commit ID and a Hadrian "flavour", with the following syntax in a YAML
1313configuration file:
1414
@@ -23,6 +23,10 @@ In the following example the commit ID is "5be7ad..." and the flavour is
2323compiler : ghc-git-5be7ad7861c8d39f60b7101fd8d8e816ff50353a-quick
2424~~~
2525
26+ The [`-j`, `--jobs` option](../configure/global_flags.md#-jobs-or-j-option) at
27+ the command line or the [`jobs`](../configure/yaml/non-project.md#jobs) option
28+ in a YAML configuraton file can be used to specify Hadrian's `-j[<n>]` flag.
29+
2630By default, the code is retrieved from the main GHC repository. If you want to
2731select another repository, use the `compiler-repository` option in a YAML
2832configuration file :
@@ -33,6 +37,40 @@ compiler-repository: git://my/ghc/repository
3337# compiler-repository: https://gitlab.haskell.org/ghc/ghc.git
3438~~~
3539
40+ By default, the Hadrian build target is ` reloc-binary-dist ` on Windows and
41+ ` binary-dist ` on other operating systems. If you want to specify another
42+ Hadrian build target, use the ` compiler-target ` option in a YAML configuration
43+ file:
44+
45+ ~~~ yaml
46+ compiler-target : binary-dist
47+ # default (Windows)
48+ # compiler-target: reloc-binary-dist
49+ # default (non-Windows)
50+ # compiler-target: binary-dist
51+ ~~~
52+
53+ By default, Stack assumes that the path to the binary distribution built by
54+ Hadrian is ` _build/reloc-bindist ` on Windows and ` _build/bindist ` on other
55+ operating systems. If you want to specify another path, use the
56+ ` compiler-bindist-path ` option in a YAML configuration file:
57+
58+ ~~~ yaml
59+ compiler-bindist-path : _build/bindist
60+ # default (Windows)
61+ # compiler-bindist-path: _build/reloc-bindist
62+ # default (non-Windows)
63+ # compiler-bindist-path: _build/bindist
64+ ~~~
65+
66+ !!! note
67+
68+ The Hadrian build target `reloc-binary-dist` was introduced with Git commit
69+ id
70+ [`fe23629b147d419053052e6e881f6e8ddfbf3bae`](https://gitlab.haskell.org/ghc/ghc/-/commit/fe23629b147d419053052e6e881f6e8ddfbf3bae).
71+
72+ Once introduced, the target must be used on Windows.
73+
3674Stack does not check the compiler version when it uses a compiler built from
3775source. It is assumed that the built compiler is recent enough as Stack does not
3876enable any known workaround to make older compilers work.
@@ -59,13 +97,17 @@ fully managed by Stack.
5997 configure: error: GHC version 9.2 or later is required to compile GHC.
6098 ~~~
6199
62- The resolution is: (1) to specify an alternative snapshot (one that
63- specifies a sufficiently recent version of GHC) on the command line, using
64- Stack's option `--snapshot <snapshot>`. Stack will use that snapshot when
65- running GHC's `configure` script; and (2) to set the contents of the `STACK`
66- environment variable to be `stack --snapshot <snapshot>`. Hadrian's
67- `build-stack` script wil refer to that environment variable for the Stack
68- command it uses.
100+ The resolution is:
101+
102+ 1. to specify an alternative snapshot (one that specifies a sufficiently
103+ recent version of GHC) on the command line, using Stack's option
104+ `--snapshot <snapshot>`. Stack will use that snapshot when running GHC's
105+ `configure` script; and
106+
107+ 2. to set the contents of the `STACK` environment variable to be
108+ `stack --snapshot <snapshot>`. If `<snapshot>` is a path to a local YAML
109+ file, it needs to be an absolute one. Hadrian's `build-stack` script
110+ will refer to that environment variable for the Stack command it uses.
69111
70112### Hadrian prerequisites
71113
@@ -121,8 +163,10 @@ Stack will build and install `happy` and `alex`, if not already on the PATH.
121163 # documentation from a single source file, including `makeinfo`.
122164 stack exec -- pacman --sync mingw-w64-x86_64-ca-certificates
123165 # Common CA (certificate authority) certificates.
124- stack exec -- pip install -U sphinx
166+ stack exec -- pacman -sync mingw-w64-x86_64-python- sphinx
125167 # Sphinx is the Python documentation generator.
168+ stack exec -- pacman -sync mingw-w64-x86_64-texlive-full
169+ # The TeX Live distribution.
126170 ~~~
127171
128172 Hadrian may require certain LaTeX packages and may prompt for these to be
0 commit comments