Skip to content

Commit 98025f5

Browse files
committed
Conform to PATH, where appropriate
Also makes other amendments in the affected passages.
1 parent 05147a6 commit 98025f5

File tree

8 files changed

+105
-84
lines changed

8 files changed

+105
-84
lines changed

doc/GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ We've already used `stack exec` multiple times in this guide. As you've likely
11461146
already guessed, it allows you to run executables, but with a slightly modified
11471147
environment. In particular: `stack exec` looks for executables on Stack's bin
11481148
paths, and sets a few additional environment variables (like adding those paths
1149-
to `PATH`, and setting `GHC_PACKAGE_PATH`, which tells GHC which package
1149+
to the PATH, and setting `GHC_PACKAGE_PATH`, which tells GHC which package
11501150
databases to use).
11511151
11521152
If you want to see exactly what the modified environment looks like, try:

doc/developing_on_windows.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,26 @@ additional entries via a pull request.
4141

4242
* For [text-icu](https://github.com/bos/text-icu) install `mingw64/mingw-w64-x86_64-icu`
4343

44-
## Cmake ##
45-
46-
Cmake has trouble finding other tools even if they are available on
47-
the `PATH`. Likely this is not a cmake problem but one of the
48-
environment not fully integrating. For example GHC comes with a copy
49-
of GCC which is not installed by MSYS2 itself. If you want to use this
50-
GCC you can provide a full path to it, or find it first with
51-
`System.Directory.findExecutable` if you want to launch GCC from a
52-
Haskell file such as `Setup.hs`.
53-
54-
Experience tells that the `mingw-w64` versions of make and cmake are
55-
most likely to work. Though there are other versions available through
56-
pacman, so have a look to see what works for you. Both tools can be
57-
installed with the commands:
58-
59-
```
60-
stack exec -- pacman -S mingw-w64-x86_64-make
61-
stack exec -- pacman -S mingw-w64-x86_64-cmake
62-
```
63-
64-
Even though make and cmake are then both installed into the same
65-
environment. Cmake still seems to have trouble to find make. To help
66-
cmake find GCC and make supply the following flags:
67-
68-
```
69-
-DCMAKE_C_COMPILER=path
70-
-DCMAKE_MAKE_PROGRAM=path
71-
```
44+
## CMake ##
45+
46+
CMake has trouble finding other tools even if they are available on the PATH.
47+
Likely this is not a CMake problem but one of the environment not fully
48+
integrating. For example GHC comes with a copy of GCC which is not installed by
49+
MSYS2 itself. If you want to use this GCC you can provide a full path to it, or
50+
find it first with `System.Directory.findExecutable` if you want to launch GCC
51+
from a Haskell file such as `Setup.hs`.
52+
53+
Experience tells that the `mingw-w64` versions of Make and CMake are most
54+
likely to work. Though there are other versions available through `pacman`, so
55+
have a look to see what works for you. Both tools can be installed with the
56+
commands:
57+
58+
stack exec -- pacman -S mingw-w64-x86_64-make
59+
stack exec -- pacman -S mingw-w64-x86_64-cmake
60+
61+
Even though Make and CMake are then both installed into the same
62+
environment, CMake still seems to have trouble to find Make. To help CMake
63+
find GCC and Make supply the following flags:
64+
65+
-DCMAKE_C_COMPILER=path
66+
-DCMAKE_MAKE_PROGRAM=path

doc/faq.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -196,41 +196,40 @@ the following line to your .cabal file:
196196

197197
You could also use the [`--custom-preprocessor-extensions` flag](yaml_configuration.md#custom-preprocessor-extensions)
198198

199-
## I already have GHC installed, can I still use stack?
199+
## I already have GHC installed, can I still use Stack?
200200

201-
Yes. In its default configuration, stack will simply ignore any system GHC
202-
installation and use a sandboxed GHC that it has installed itself (typically
203-
via the `stack setup` command). You can find these sandboxed GHC installations
204-
in `~/.stack/programs/$platform/ghc-$version/`.
201+
Yes. In its default configuration, Stack will simply ignore any system GHC
202+
installation and use a sandboxed GHC that it has installed itself. You can find
203+
these sandboxed GHC installations in the `ghc-*` directories in the
204+
`stack path --programs` directory.
205205

206-
If you would like stack to use your system GHC installation, use the
206+
If you would like Stack to use your system GHC installation, use the
207207
[`--system-ghc` flag](yaml_configuration.md#system-ghc) or run
208-
`stack config set system-ghc --global true` to make stack check your
209-
`PATH` for a suitable GHC by default.
208+
`stack config set system-ghc --global true` to make Stack check your PATH for a
209+
suitable GHC by default.
210210

211-
Note that stack can only use a system GHC installation if its version is
212-
compatible with the configuration of the current project, particularly the
213-
[`resolver` setting](yaml_configuration.md#resolver).
211+
Stack can only use a system GHC installation if its version is compatible with
212+
the configuration of the current project, particularly the
213+
[`resolver` or `snapshot` setting](yaml_configuration.md#resolver).
214214

215-
Note that GHC installation doesn't work for all OSes, so in some cases you
215+
GHC installation doesn't work for all operating systems, so in some cases you
216216
will need to use `system-ghc` and install GHC yourself.
217217

218-
## How does stack determine what GHC to use?
218+
## How does Stack determine what GHC to use?
219219

220-
In its default configuration, stack determines from the current project which
221-
GHC version, architecture etc. it needs. It then looks in
222-
`~/.stack/programs/$platform/ghc-$version/` for a compatible GHC, requesting
223-
to install one via `stack setup` if none is found.
220+
In its default configuration, Stack determines from the current project which
221+
GHC version, architecture etc it needs. It then looks in the `ghc-<version>`
222+
subdirectory of the `stack path --programs` directory for a compatible GHC,
223+
requesting to install one via `stack setup` if none is found.
224224

225225
If you are using the [`--system-ghc` flag](yaml_configuration.md/#system-ghc) or
226-
have configured `system-ghc: true` either in the project `stack.yaml`
227-
or the global `~/.stack/config.yaml`, stack will use the first GHC that it finds
228-
on your `PATH`, falling back on its sandboxed installations only if the found GHC
229-
doesn't comply with the various requirements (version, architecture) that your
230-
project needs.
226+
have configured `system-ghc: true` either in the project `stack.yaml` or the
227+
global `config.yaml`, Stack will use the first GHC that it finds on your PATH,
228+
falling back on its sandboxed installations only if the found GHC doesn't comply
229+
with the various requirements (version, architecture) that your project needs.
231230

232231
See [this issue](https://github.com/commercialhaskell/stack/issues/420) for a
233-
detailed discussion of stack's behavior when `system-ghc` is enabled.
232+
detailed discussion of Stack's behavior when `system-ghc` is enabled.
234233

235234
## How do I upgrade to GHC 7.10.2 with stack?
236235

@@ -563,12 +562,12 @@ Yes:
563562
564563
## How do I resolve linker errors when running `stack setup` or `stack build` on macOS?
565564
566-
This is likely to be caused by having a LLVM installation and default Apple
567-
Clang compiler both under the `PATH`. The symptom of this issue is a linker
568-
error "bad relocation (Invalid pointer diff)". The compiler picks up
569-
inconsistent versions of binaries and the mysterious error occurs.
565+
This is likely to be caused by having both a LLVM installation and default Apple
566+
Clang compiler on the PATH. The symptom of this issue is a linker error "bad
567+
relocation (Invalid pointer diff)". The compiler picks up inconsistent versions
568+
of binaries and the mysterious error occurs.
570569
571-
The workaround is to remove LLVM binaries from the `PATH`.
570+
The workaround is to remove LLVM binaries from the PATH.
572571
573572
## How do I suppress `'-nopie'` warnings with `stack build` on macOS?
574573

doc/glossary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The following terms are used in Stack's documentation.
99
|Cabal |The Haskell Common Architecture for Building Applications and Libraries, provided by the [`Cabal` package](https://hackage.haskell.org/package/Cabal). Also referred to as Cabal (the library) to distinguish it from Cabal (the tool).|
1010
|Cabal file|A file containing a [package description](https://cabal.readthedocs.io/en/stable/cabal-package.html) used by Cabal, named `<package_name>.cabal`.|
1111
|Cabal (the tool)|The Haskell build tool provided by the [`cabal-install` package](https://hackage.haskell.org/package/cabal-install).|
12+
|CMake |A [system](https://cmake.org/) for managing build processes.|
1213
|`config.yaml` |A non-project-specific configuration file used by Stack. |
1314
|Docker |A [platform](https://www.docker.com/) for developing, shipping, and running applications. It can package and run an application in a loosely isolated environment called a _container_.|
1415
|Emacs |[GNU Emacs](https://www.gnu.org/software/emacs/), an extensible, customisable text editor.|
@@ -26,6 +27,7 @@ The following terms are used in Stack's documentation.
2627
|Hpack |A [format](https://github.com/sol/hpack) for Haskell packages or the executable `hpack` that produces a Cabal file from `package.yaml`.|
2728
|Linux |A family of operating systems based on the Linux kernal. |
2829
|macOS |The primary operating system for Apple's Mac computers. Previously known as Mac OS X or OS X.|
30+
|Make |A [build automation tool](https://www.gnu.org/software/make/).|
2931
|MSYS2 |The [MSYS2](https://www.msys2.org/) software distribution and building platform for Windows.|
3032
|Nix |A purely functional [package manager](https://nixos.org/), available for Linux and macOS.|
3133
|`package.yaml` |A file that describes a package in the Hpack format. |

doc/install_and_upgrade.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ If you're attempting to install stack from within China:
319319

320320
```
321321
###ADD THIS IF YOU LIVE IN CHINA
322-
setup-info-locations:
322+
setup-info-locations:
323323
- "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml"
324324
urls:
325325
latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json
@@ -341,47 +341,64 @@ package-indices:
341341
ignore-expiry: no
342342
```
343343

344-
## Using an http proxy
344+
## Using an HTTP proxy
345345

346-
To use `stack` behind a http proxy with ip address *IP* and port *PORT*, first set up an environment variable `http_proxy` and then run the stack command. _e.g._
346+
To use Stack behind a HTTP proxy with IP address *IP* and port *PORT*, first set
347+
up an environment variable `http_proxy` and then run the Stack command. _eg_
347348

348-
```
349-
$ export http_proxy=IP:PORT
350-
$ stack install
351-
```
349+
$ export http_proxy=IP:PORT
350+
$ stack install
352351

353-
Note that on most operating systems, it is not mandatory for programs to follow the "system-wide" http proxy. Some programs, such as browsers, do honor this "system-wide" http proxy setting, while other programs, including bash, do not. That means configuring "http proxy setting" in your Control Panel (Windows) or System Preferences (Mac) would not result in `stack` traffic going through the proxy.
352+
On most operating systems, it is not mandatory for programs to follow the
353+
"system-wide" HTTP proxy. Some programs, such as browsers, do honor this
354+
"system-wide" HTTP proxy setting, while other programs, including bash, do not.
355+
That means configuring "http proxy setting" in your Control Panel (Windows) or
356+
System Preferences (Mac) would not result in Stack traffic going through the
357+
proxy.
354358

355359
## Upgrade
356360

357361
There are essentially four different approaches to upgrade:
358362

359-
* The `stack` tool itself ships with an `upgrade` command, which download a `stack` binary or build it from source and install it to the default install path (e.g. `~/.local/bin` or `%APPDATA%\local\bin`; see the [Path](#Path) section above). You can use `stack upgrade` to get the latest official release, and `stack upgrade --git` to install from Git and live on the bleeding edge. Make sure the default install directory is on your `PATH` and takes precedence over the system installed `stack`, or copy `stack` from that directory to the system location afterward. For more information, see [this discussion](https://github.com/commercialhaskell/stack/issues/237#issuecomment-126793301).
363+
* Stack itself ships with an `upgrade` command, which downloads a `stack` binary
364+
or builds it from source and install it to the default `install` directory (eg
365+
`stack path --local-bin`; see the [Path](#Path) section above). You can use
366+
`stack upgrade` to get the latest official release, and `stack upgrade --git`
367+
to install from Git and live on the bleeding edge. Make sure the default
368+
`install` directory is on your PATH and takes precedence over the system
369+
installed `stack`, or copy `stack` from that directory to the system location
370+
afterward. For more information, see
371+
[this discussion](https://github.com/commercialhaskell/stack/issues/237#issuecomment-126793301).
360372

361-
* If you're using a package manager and are happy with sticking with the officially released binaries from the distribution (which may the lag behind latest version of Stack significantly), simply follow your normal package manager strategies for upgrading (e.g. `apt-get update && apt-get upgrade`).
373+
* If you're using a package manager and are happy with sticking with the
374+
officially released binaries from the distribution (which may the lag behind
375+
latest version of Stack significantly), simply follow your normal package
376+
manager strategies for upgrading (eg `apt-get update && apt-get upgrade`).
362377

363-
* The get.haskellstack.org script supports the `-f` argument to over-write the current stack executable. For example:
378+
* The `get.haskellstack.org` script supports the `-f` argument to over-write the
379+
current Stack executable. For example:
364380

365381
curl -sSL https://get.haskellstack.org/ | sh -s - -f
366382

367383
or:
368384

369385
wget -qO- https://get.haskellstack.org/ | sh -s - -f
370386

371-
* Manually follow the steps above to download the newest binaries from the release page and replace the old binary.
387+
* Manually follow the steps above to download the newest binaries from the
388+
release page and replace the old binary.
372389

373390
## Install Older Versions
374391

375-
To install a specific version of stack, navigate to the desired version on
392+
To install a specific version of stack, navigate to the desired version on
376393
[the GitHub release page](https://github.com/fpco/stack/releases),
377394
and click the appropriate link under its "Assets" drop-down menu.
378395

379-
Alternatively, use the URL
396+
Alternatively, use the URL
380397
`https://github.com/commercialhaskell/stack/releases/download/vVERSION/stack-VERSION-PLATFORM.EXTENSION`.
381398
For example, the tarball for stack 2.1.0.1, osx-x86_64 is at
382399
`https://github.com/commercialhaskell/stack/releases/download/v2.1.0.1/stack-2.1.0.1-osx-x86_64.tar.gz`.
383400

384-
Here's a snippet for `appveyor.yml` files, borrowed from `dhall`'s
401+
Here's a snippet for `appveyor.yml` files, borrowed from `dhall`'s
385402
[`appveyor.yml`](https://github.com/dhall-lang/dhall-haskell/blob/1079b7a3a7a6922f72a373e47daf6f1b74f128b1/appveyor.yml).
386403
Change the values of PATH and VERSION as needed.
387404

doc/maintainers/docker.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,21 @@ Replace `<N>` with major version of new LTS snapshot, and `<N-1>` with previous
7272

7373
- Build the image: `docker build -t local/stack-build lts-<N>.0/`.
7474

75-
- Ensure that all the directories listed in `PATH`, `CUDA_PATH`, and `CPATH` and any other path-like environment variables actually exist in the image.
75+
- Ensure that all the directories listed in `PATH`, `CUDA_PATH`, and `CPATH` and
76+
any other path-like environment variables actually exist in the image.
7677

77-
- Try building a test package with the new image: `(stack --resolver=nightly new image-test && cd image-test && stack --docker --docker-image=local/stack-build build)`. This should build without needing to install GHC.
78+
- Try building a test package with the new image:
79+
`stack --resolver=nightly new image-test`, `cd image-test`,
80+
`stack --docker --docker-image=local/stack-build build`. This should build
81+
without needing to install GHC.
7882

79-
- Build the "small" variant: `docker build -t local/stack-build-small --build-arg "VARIANT=small" lts-<N>.0/`.
83+
- Build the "small" variant:
84+
`docker build -t local/stack-build-small --build-arg "VARIANT=small" lts-<N>.0/`.
8085

81-
- Try building a test package with the new small image: `(stack --resolver=nightly new small-image-test && cd small-image-test && stack --docker --docker-image=local/stack-build-small build)`. This should build without needing to install GHC.
86+
- Try building a test package with the new small image:
87+
`stack --resolver=nightly new small-image-test`, `cd small-image-test`,
88+
`stack --docker --docker-image=local/stack-build-small build`. This should
89+
build without needing to install GHC.
8290

8391
### Build real image once major LTS snapshot has been released
8492

doc/nix_integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ By default, Stack will run the build in a *pure* Nix build environment (or
154154
installed elsewhere on your system. This behaviour enforces a complete
155155
description of the build environment to facilitate reproducibility.
156156

157-
To override this behaviour, add `pure: false` to your `stack.yaml` or pass the
158-
`--no-nix-pure` option to the command line.
157+
To override this behaviour, add `pure: false` to your `stack.yaml` file or pass
158+
the `--no-nix-pure` option to the command line.
159159

160160
**Note:** On macOS shells are non-pure by default currently. This is due soon to
161161
be resolved locale issues. So on macOS you'll need to be a bit more careful to

doc/yaml_configuration.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,9 +1107,9 @@ Since 0.1.2.0
11071107

11081108
### extra-path
11091109

1110-
This option specifies additional directories to prepend to the PATH environment
1111-
variable. These will be used when resolving the location of executables, and
1112-
will also be visible in the `PATH` variable of processes run by stack.
1110+
This option specifies additional directories to prepend to the PATH. These will
1111+
be used when resolving the location of executables, and will also be visible in
1112+
the PATH of processes run by Stack.
11131113

11141114
For example, to prepend `/path-to-some-dep/bin` to your PATH:
11151115

@@ -1118,9 +1118,9 @@ extra-path:
11181118
- /path-to-some-dep/bin
11191119
```
11201120

1121-
One thing to note is that other paths added by stack - things like the project's
1122-
bin dir and the compiler's bin dir - will take precedence over those specified
1123-
here (the automatic paths get prepended).
1121+
Other paths added by Stack - things like the project's binary directory and the
1122+
compiler's binary directory - will take precedence over those specified here
1123+
(the automatic paths get prepended).
11241124

11251125
Since 0.1.4.0
11261126

0 commit comments

Comments
 (0)