Cabal checks extra-tool-paths before it needs them.
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
@hvr suggested using `pkg-config-location` as a workaround for #6304.
The problem however is that cabal checks if the paths to these tools exist even when it doesn't make a call to
use the tools. The issue this is causing is that when installing `cabal` through chocolatey I would like to make it as friction less as possible. Installing `msys2` is not a hard requirement and I can't guarantee the order in which `cabal` and `msys2` are installed.
So I pre-populate the `pkg-config-location` with the expected paths to `msys2`. But then this makes it unusable if `msys2` isn't installed at some point since cabal will bail out saying the path can't be found.
Which is perfectly reasonable if it was doing something requiring the tool at that point, but if it's not it shouldn't. This allows flexibily in setting up cabal with optional dependencies.
side note: It would be very neat if you could specify in the config file which command the user can run to install the missing tool. i.e. if I could say something `To install pkg-config run 'mingw64-pkg install pkg-config' to install this tool.`
**To Reproduce**
```
cabal user-config update -a 'program-locations' -a ' pkg-config-location: C:\pkg-config.exe'
cabal v2-repl
```
**Expected behavior**
I expect ghci to start up and not cabal failing with `C:\pkg-confi.exe` not found.
**System information**
- Windows 10
- cabal 3.0.0.0 GHC 8.8.1
**Additional context**
I currently require the user to re-install the cabal package after they install msys2 and after they install pkg-config, but that's not very obvious and not very friction free.
Contributor guide
Assessment
This issue has not been assessed yet.