Skip to content

Commit b750631

Browse files
authored
Merge pull request #5794 from mpilgrem/docs-setup-info
Extend documentation of setup-info etc
2 parents b669e57 + 0afdee5 commit b750631

File tree

1 file changed

+111
-52
lines changed

1 file changed

+111
-52
lines changed

doc/yaml_configuration.md

Lines changed: 111 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ configure-options:
618618

619619
(Since 0.1.5)
620620

621-
Specify a variant binary distribution of GHC to use. Known values:
621+
Specify a variant binary distribution of GHC to use. Known values:
622622

623623
* `standard`: This is the default, uses the standard GHC binary distribution
624624
* `integersimple`: Use a GHC bindist that uses
@@ -636,52 +636,139 @@ This option is incompatible with `system-ghc: true`.
636636

637637
Specify a specialized architecture bindist to use. Normally this is
638638
determined automatically, but you can override the autodetected value here.
639-
Possible arguments include `standard`, `gmp4`, `tinfo6`, and `nopie`.
639+
Possible arguments include `standard`, `gmp4`, `nopie`, `tinfo6`,
640+
`tinfo6-nopie`, `ncurses6`, and `integersimple`.
640641

641-
### setup-info-locations
642+
### setup-info
642643

643-
(Since 2.3)
644+
(Since 0.1.5)
645+
646+
The `setup-info` dictionary specifies download locations for tools to be
647+
installed during set-up, such as GHC or, on Windows, 7z and MSYS2. The
648+
dictionary maps `('Tool', 'Platform', 'Version')` to the location where it can
649+
be obtained. For example, mapping `(GHC, 64-bit Windows, 9.2.3)` to the URL
650+
hosting the archive file for GHC's installation.
644651

645-
Possible usages of this config are:
646-
1. Using `stack` offline or behind a firewall
647-
2. Extending the tools known to `stack` such as cutting-edge versions of `ghc` or builds for custom linux distributions.
652+
Possible usages of this configuration option are:
648653

649-
The `setup-info` dictionary specifies locations for installation of Haskell-related tooling - it maps `(Tool, Platform, Version)` to the location where it can be obtained, such as `(GHC, Windows64, 8.6.5)` to the url hosting the `*.tar.xz` for GHC's installation.
654+
1. Using Stack offline or behind a firewall.
655+
2. Extending the tools known to Stack, such as cutting-edge versions of GHC or
656+
builds for custom Linux distributions (for use with the
657+
[ghc-variant](#ghc-variant) option).
650658

651-
By default, it's obtained from [stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml).
659+
By default, Stack obtains the dictionary from
660+
[stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml).
652661

653662
The `setup-info` dictionary is constructed in the following order:
654-
1. `setup-info` yaml configuration - inline config
655-
2. `--setup-info-yaml` command line arguments - urls or paths, multiple locations may be specified.
656-
3. `setup-info-locations` yaml configuration - urls or paths
663+
1. `setup-info` in the YAML configuration - inline configuration
664+
2. `--setup-info-yaml` command line arguments - URLs or paths. Multiple
665+
locations may be specified.
666+
3. `setup-info-locations` in the YAML configuration - URLs or paths. See further
667+
below.
668+
669+
The format of this field is the same as in the default
670+
[stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml).
671+
For example, GHC 9.2.3 of custom variant `myvariant` (see further below) on
672+
64-bit Windows:
673+
674+
```yaml
675+
setup-info:
676+
ghc:
677+
windows64-custom-myvariant:
678+
9.2.3:
679+
url: "https://example.com/ghc-9.2.3-x86_64-unknown-mingw32-myvariant.tar.xz"
680+
```
681+
682+
'Platforms' are pairs of an operating system and a machine architecture (for
683+
example, 32-bit i386 or 64-bit x86-64) (represented by the
684+
`Cabal.Distribution.Systems.Platform` type). Stack currently (version 2.7.5)
685+
supports the following pairs in the format of the `setup-info` field:
686+
687+
|Operating system|I386 arch|X86_64 arch|Other machine architectures |
688+
|----------------|---------|-----------|------------------------------------------------------------|
689+
|Linux |linux32 |linux64 |AArch64: linux-aarch64, Arm: linux-armv7, Sparc: linux-sparc|
690+
|OSX |macos |macos | |
691+
|Windows |windows32|windows64 | |
692+
|FreeBSD |freebsd32|freebsd64 |AArch64: freebsd-aarch64 |
693+
|OpenBSD |openbsd32|openbsd64 | |
694+
695+
For GHC, the distinguishing 'Version' in the field format includes a 'tag' for
696+
any (optional) GHC variant (see [ghc-variant](#ghc-variant)) and a further 'tag'
697+
for any (optional) specialised GHC build (see [ghc-build](#ghc-build)).
698+
699+
The optional variant 'tag' is either `-integersimple` or
700+
`-custom-<custom_variant_name>`.
701+
702+
For example, for GHC 9.0.2 of specialised GHC build `tinfo6` on x86_64 Linux:
703+
~~~yaml
704+
setup-info:
705+
ghc:
706+
linux64-tinfo6:
707+
9.0.2:
708+
url: "http://downloads.haskell.org/~ghc/9.0.2/ghc-9.0.2a-x86_64-fedora27-linux.tar.xz"
709+
content-length: 237286244
710+
sha1: affc2aaa3e6a1c446698a884f56a0a13e57f00b4
711+
sha256: b2670e9f278e10355b0475c2cc3b8842490f1bca3c70c306f104aa60caff37b0
712+
~~~
713+
714+
On Windows, the required 7z executable and DLL tools are represented in the
715+
format of the `setup-info` field simply by `sevenzexe-info` and
716+
`sevenzdll-info`.
717+
718+
This configuration **adds** the specified setup information metadata to the
719+
default. Specifying this configuration **does not** prevent the default
720+
[stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml)
721+
from being consulted as a fallback. If, however, you need to **replace** the
722+
default `setup-info` dictionary, use the following:
723+
724+
```yaml
725+
setup-info-locations: []
726+
```
727+
### setup-info-locations
657728

658-
The first location which specifies the location of a tool `(Tool, Platform, Version)` takes precedence, so one can extend the default tools with a fallback to the default `setup-info` location:
729+
(Since 2.3)
730+
731+
By way of introduction, see the [`setup-info`](#setup-info) option. This option
732+
specifies the location(s) of `setup-info` dictionaries.
733+
734+
The first location which provides a dictionary that specifies the location of a
735+
tool - `('Tool', 'Platform', 'Version')` - takes precedence. For example, you
736+
can extend the default tools, with a fallback to the default `setup-info`
737+
location, as follows:
659738

660739
```yaml
661740
setup-info-locations:
662741
- C:/stack-offline/my-stack-setup.yaml
663742
- relative/inside/my/project/setup-info.yaml
664743
- \\smbShare\stack\my-stack-setup.yaml
665744
- http://stack-mirror.com/stack-setup.yaml
745+
# Fallback to the default location
666746
- https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml
667747
```
668748

669-
The default `setup-info` location is included only if no locations in the `setup-info-locations` config or the `--setup-info-yaml` command line argument were specified.
749+
Stack only refers to the default `setup-info` location if no locations are
750+
specified in the `setup-info-locations` configuration or on the command line
751+
using the `--setup-info-yaml` option.
752+
753+
For example, both of the following will cause `stack setup` not to consult the
754+
default `setup-info` location:
670755

671-
Thus the following will cause `stack setup` not to consult github for the `setup-info`:
672756
```yaml
673757
setup-info-locations:
674758
- C:/stack-offline/my-stack-setup.yaml
675759
```
760+
and
676761

677762
```yaml
678763
setup-info-locations: []
679764
```
680765

681-
Relative paths are resolved relative to the `stack.yaml` file - either in the local project or the global `stack.yaml` in the stack directory.
766+
Relative paths are resolved relative to the `stack.yaml` file (either the one in
767+
the local project or the global `stack.yaml`).
682768

683-
Relative paths may also be used inside paths to tool installs - such as for ghc or 7z, which allows vendoring the tools inside a monorepo.
684-
For example:
769+
Relative paths may also be used for the installation paths to tools (such as GHC
770+
or 7z). This allows vendoring the tools inside a monorepo (a single respository
771+
storing many projects). For example:
685772

686773
Directory structure:
687774
```
@@ -690,7 +777,7 @@ Directory structure:
690777
- my-stack-setup.yaml
691778
- 7z.exe
692779
- 7z.dll
693-
- ghc-8.2.2.tar.xz
780+
- ghc-9.2.3.tar.xz
694781
- stack.yaml
695782
```
696783

@@ -703,42 +790,15 @@ setup-info-locations:
703790
In `installs/my-stack-setup.yaml`:
704791
```yaml
705792
sevenzexe-info:
706-
url: "installs/7z.exe"
793+
url: "installs/7z.exe"
707794
708795
sevenzdll-info:
709-
url: "installs/7z.dll"
796+
url: "installs/7z.dll"
710797
711798
ghc:
712-
windows64:
713-
8.2.2:
714-
url: "installs/ghc-8.2.2.tar.xz"
715-
```
716-
717-
### setup-info
718-
719-
(Since 0.1.5)
720-
721-
Allows augmenting from where tools like GHC and MSYS2 (on Windows) are
722-
downloaded. Most useful for specifying locations of custom GHC binary
723-
distributions (for use with the [ghc-variant](#ghc-variant) option).
724-
725-
The format of this field is the same as in the default [stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml):
726-
727-
```yaml
728-
setup-info:
729-
ghc:
730-
windows32-custom-foo:
731-
7.10.2:
732-
url: "https://example.com/ghc-7.10.2-i386-unknown-mingw32-foo.tar.xz"
733-
```
734-
735-
This configuration **adds** the specified setup info metadata to the default;
736-
Specifying this config **does not** prevent the default `stack-setup-2.yaml` from being consulted as a fallback.
737-
738-
If you need to **replace** the default setup-info, add the following:
739-
740-
```yaml
741-
setup-info-locations: []
799+
windows64:
800+
9.2.3:
801+
url: "installs/ghc-9.2.3.tar.xz"
742802
```
743803

744804
### pvp-bounds
@@ -1197,5 +1257,4 @@ has the following effect:
11971257

11981258
This field is convenient in setups that restrict access to GitHub, for instance closed corporate setups. In this setting, it is common for the development environment to have general access to the internet, but not for testing/building environments. To avoid the firewall, one can run a local snapshots mirror and then use a custom `snapshot-location-base` in the closed environments only.
11991259

1200-
12011260
Since 2.5.0

0 commit comments

Comments
 (0)