Skip to content

Commit e390033

Browse files
authored
Merge pull request #4798 from mpilgrem/4726-local-programs-path
Fix #4726: Improve docs on stack's programs path, on Windows
2 parents 66b040f + 39be0b0 commit e390033

File tree

4 files changed

+42
-18
lines changed

4 files changed

+42
-18
lines changed

doc/GUIDE.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ __resolver__, to the snapshot which your package will be built against.
3737

3838
Finally, stack is __isolated__: it will not make changes outside of specific
3939
stack directories. stack-built files generally go in either the stack root
40-
directory (default `~/.stack`) or `./.stack-work` directories local to each
41-
project. The stack root directory holds packages belonging to snapshots and any
42-
stack-installed versions of GHC. Stack will not tamper with any system version
43-
of GHC or interfere with packages installed by `cabal` or any other build tools.
40+
directory (default `~/.stack` or, on Windows, `%LOCALAPPDATA%\Programs\stack`)
41+
or `./.stack-work` directories local to each project. The stack root directory
42+
holds packages belonging to snapshots and any stack-installed versions of GHC.
43+
Stack will not tamper with any system version of GHC or interfere with packages
44+
installed by `cabal` or any other build tools.
4445

4546
_NOTE_ In this guide, we'll use commands as run on a GNU/Linux system
4647
(specifically Ubuntu 14.04, 64-bit) and share output from that. Output on other
@@ -558,8 +559,8 @@ Haskell packages, this will often be enough to build most packages. However,
558559
at times, you may find that not all dependencies required may be available in
559560
the Stackage snapshots.
560561

561-
Let's simulate an unsatisfied dependency by adding acme-missiles to the list of dependencies
562-
the build requires. This is done by including it in the `Build-depends` section in the .cabal file
562+
Let's simulate an unsatisfied dependency by adding acme-missiles to the list of dependencies
563+
the build requires. This is done by including it in the `Build-depends` section in the .cabal file
563564
and then re-initing:
564565

565566
```
@@ -1198,7 +1199,8 @@ While we're talking about paths, to wipe our stack install completely, here's
11981199
what needs to be removed:
11991200
12001201
1. The stack executable itself
1201-
2. The stack root, e.g. `$HOME/.stack` on non-Windows systems.
1202+
2. The stack root, e.g. `$HOME/.stack` on non-Windows systems or, on Windows,
1203+
`%LOCALAPPDATA%\Programs\stack`.
12021204
* See `stack path --stack-root`
12031205
* On Windows, you will also need to delete `stack path --programs`
12041206
3. Any local `.stack-work` directories inside a project

doc/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ stack ghci
148148
λ: :main --stack-root /path/to/root/ --stack-yaml /path/to/stack.yaml COMMAND
149149
```
150150

151-
This allows you to set a special stack root (instead of `~/.stack/`) and to
152-
target your commands at a particular `stack.yaml` instead of the one found in
153-
the current directory.
151+
This allows you to set a special stack root (instead of `~/.stack/` or, on
152+
Windows, `%LOCALAPPDATA%\Programs\stack`) and to target your commands at a
153+
particular `stack.yaml` instead of the one found in the current directory.
154154

155155
#### Complete guide to stack
156156

@@ -203,4 +203,3 @@ label on the Github issue tracker.
203203

204204
#### How to uninstall
205205
Removing ``~/.stack`` and ``/usr/local/bin/stack`` should be sufficient. You may want to delete ``.stack-work`` folders in any Haskell projects that you have built.
206-

doc/faq.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,17 @@ copying the files somewhere Windows finds them (cf. https://msdn.microsoft.com/d
360360
361361
Cf. issue [#425](https://github.com/commercialhaskell/stack/issues/425).
362362
363+
Another issue that may arise with building on Windows is as follows. The default
364+
location of stack's programs folder is `%LOCALAPPDATA\Programs\stack`. If there
365+
is a space character in the `%LOCALAPPDATA%` path this may, in some
366+
circumstances, cause problems with building packages that make use of the GNU
367+
project's `autoconf` package and `configure` shell script files. It may be
368+
necessary to override the default location of stack's programs folder. See
369+
[Non-project-specific config option, local-programs-path](yaml_configuration.md)
370+
for more informaton.
371+
372+
Cf. issue [#4726](https://github.com/commercialhaskell/stack/issues/4726)
373+
363374
## Can I change stack's default temporary directory?
364375
365376
Stack downloads and extracts files to `$STACK_ROOT/programs` on most platforms,

doc/yaml_configuration.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,10 @@ extra-lib-dirs:
475475
```
476476

477477
Since these are system-dependent absolute paths, it is recommended that you
478-
specify these in your `config.yaml` within the stack root (usually, `~/.stack`).
479-
If you control the build environment in your project's ``stack.yaml``, perhaps
480-
through docker or other means, then it may well make sense to include these
481-
there as well.
478+
specify these in your `config.yaml` within the stack root (usually, `~/.stack`
479+
or, on Windows, `%LOCALAPPDATA%\Programs\stack`). If you control the build
480+
environment in your project's ``stack.yaml``, perhaps through docker or other
481+
means, then it may well make sense to include these there as well.
482482

483483

484484
### with-gcc
@@ -1004,9 +1004,21 @@ This overrides the location of the programs directory, where tools like ghc and
10041004
msys get installed.
10051005

10061006
On most systems, this defaults to a folder called `programs`
1007-
within the stack root directory. On windows, if the `LOCALAPPDATA` environment
1008-
variable exists, then it defaults to `$LOCALAPPDATA/Programs/stack/`, which
1009-
follows windows conventions.
1007+
within the stack root directory. On Windows, if the `LOCALAPPDATA` environment
1008+
variable exists, then it defaults to `%LOCALAPPDATA%\Programs\stack`, which
1009+
follows Windows' conventions.
1010+
1011+
__NOTE__: On Windows, if there is a space character in the `%LOCALAPPDATA%` path
1012+
(which may be the case if the relevant user account name and its corresponding
1013+
user profie path have a space) this may cause problems with building packages
1014+
that make use of the GNU project's `autoconf` package and `configure` shell
1015+
script files. That may be the case particularly if there is no corresponding
1016+
short name ('8 dot 3' name) for the folder in the path with the space (which may
1017+
be the case if '8 dot 3' names have been stripped or their creation not enabled
1018+
by default). If there are problems building, it will be necessary to override
1019+
the default location of stack's programs directory to specify an alternative
1020+
path that does not contain space characters. Examples of packages on Hackage
1021+
that make use of `configure` are `network` and `process`.
10101022

10111023
Since 1.3.0
10121024

0 commit comments

Comments
 (0)