Skip to content

Commit 7ee0d49

Browse files
committed
Append paths in global config to progdb in configureCompiler
1 parent 595d023 commit 7ee0d49

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ configureCompiler
476476
{ projectConfigHcFlavor
477477
, projectConfigHcPath
478478
, projectConfigHcPkg
479+
, projectConfigProgPathExtra
479480
}
480481
, projectConfigLocalPackages =
481482
PackageConfig
@@ -500,24 +501,26 @@ configureCompiler
500501
$ do
501502
liftIO $ info verbosity "Compiler settings changed, reconfiguring..."
502503
let extraPath = fromNubList packageConfigProgramPathExtra
504+
-- Add paths in the local config
503505
progdb <- liftIO $ prependProgramSearchPath verbosity extraPath [] defaultProgramDb
504-
let progdb' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb
505-
result@(_, _, progdb'') <-
506+
-- Add paths in the global config
507+
progdb' <- liftIO $ prependProgramSearchPath verbosity (fromNubList projectConfigProgPathExtra) [] progdb
508+
let progdb'' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb'
509+
result@(_, _, progdb''') <-
506510
liftIO $
507511
Cabal.configCompilerEx
508512
hcFlavor
509513
hcPath
510514
hcPkg
511-
progdb'
515+
progdb''
512516
verbosity
513-
514517
-- Note that we added the user-supplied program locations and args
515518
-- for /all/ programs, not just those for the compiler prog and
516519
-- compiler-related utils. In principle we don't know which programs
517520
-- the compiler will configure (and it does vary between compilers).
518521
-- We do know however that the compiler will only configure the
519522
-- programs it cares about, and those are the ones we monitor here.
520-
monitorFiles (programsMonitorFiles progdb'')
523+
monitorFiles (programsMonitorFiles progdb''')
521524

522525
-- Note: There is currently a bug here: we are dropping unconfigured
523526
-- programs from the 'ProgramDb' when we re-use the cache created by

changelog.d/pr-10790

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: Prepend the global extra paths to the `ProgramDb` sooner
2+
packages: cabal-install
3+
prs: #10790
4+
issues: #9800
5+
significance: significant
6+
7+
description: {
8+
9+
- The initial configuration of programs was done without the `extra-prog-path` from the global cabal configuration. This meant that in some cases, some executables were not found. In particular this manifested as Windows users who didn't add the MSYS2 paths to the global PATH couldn't make use of `pkg-config`.
10+
11+
}

0 commit comments

Comments
 (0)