Manual.md: update haskell instructions

This commit is contained in:
ii8 2025-07-22 10:06:36 +01:00
parent 6454d3f62c
commit 91ed3d9e2c

View file

@ -1138,6 +1138,10 @@ for compiling cargo -sys crates.
It also adds a `cargo` wrapper that detects and passes builds through `cargo-auditable`.
This helper is added by default for packages that use the `cargo` build style.
- `haskell` specifies environment variables for cabal.
This helper is added by default for packages that use the `haskell-stack` or
`cabal` build style.
<a id="functions"></a>
### Functions
@ -1698,21 +1702,45 @@ The path to the package's source inside `$GOPATH` is available as
<a id="pkgs_haskell"></a>
#### Haskell packages
We build Haskell package using `stack` from
[Stackage](http://www.stackage.org/), generally the LTS versions.
Haskell templates need to have host dependencies on `ghc` and `stack`,
and set build style to `haskell-stack`.
Haskell packages can be built either with the `cabal` or `haskell-stack`
build style, use whichever is more convenient or better supported by upstream,
sometimes only one of the two is possible. For packages that have haskell
parts but use a different build style like `gnu-makefile`, make sure to use
the `haskell` build helper.
The following variables influence how Haskell packages are built:
The following variables influence how packages are built with cabal:
- `cabal_index_state`: The state of the hackage cabal index to use for
fetching dependencies. The source package of a haskell project should
come with a freeze file that sets the index state, some also set it in
their cabal project file. If it does not, then this has to be set to an ISO
timestamp in the package template. For example `2025-07-05T14:01:16Z`.
- `configure_args`: Arguments passed to `cabal configure`. The configure step
generates the `cabal.project.local` file.
- `make_build_args`: Arguments passed to `cabal build`.
- `make_build_target`: Target passed to `cabal build`.
- `make_check_args`: Arguments passed to `cabal test`.
- `make_check_target`: Test target passed to cabal instead of "test".
- `make_install_target`: Target passed to `cabal install`.
And these variables influence how packages are built with stack:
- `stackage`: The Stackage version used to build the package, e.g.
`lts-3.5`. Alternatively:
- You can prepare a `stack.yaml` configuration for the project and put it
into `files/stack.yaml`.
- If a `stack.yaml` file is present in the source files, it will be used
- If a `stack.yaml` file is present in the source files, it will be used.
- `make_build_args`: This is passed as-is to `stack build ...`, so
you can add your `--flag ...` parameters there.
To patch dependencies of haskell packages they have to be fetched explicitly
from hackage by adding them to `distfiles` instead of letting cabal or stack
download them. Once extracted and patched, the path to the patched version
can be added to `packages` in `cabal.project` or `stack.yaml`.
Stack will find them automatically if no `stack.yaml` file exists by scanning
the directory. The build tool will then use the patched version of the
depencency instead of downloading it from hackage.
<a id="pkgs_font"></a>
#### Font packages