Skip to content

Commit

Permalink
Append paths in global config to progdb in configureCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Feb 10, 2025
1 parent 595d023 commit 7ee0d49
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ configureCompiler
{ projectConfigHcFlavor
, projectConfigHcPath
, projectConfigHcPkg
, projectConfigProgPathExtra
}
, projectConfigLocalPackages =
PackageConfig
Expand All @@ -500,24 +501,26 @@ configureCompiler
$ do
liftIO $ info verbosity "Compiler settings changed, reconfiguring..."
let extraPath = fromNubList packageConfigProgramPathExtra
-- Add paths in the local config
progdb <- liftIO $ prependProgramSearchPath verbosity extraPath [] defaultProgramDb
let progdb' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb
result@(_, _, progdb'') <-
-- Add paths in the global config
progdb' <- liftIO $ prependProgramSearchPath verbosity (fromNubList projectConfigProgPathExtra) [] progdb
let progdb'' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb'
result@(_, _, progdb''') <-
liftIO $
Cabal.configCompilerEx
hcFlavor
hcPath
hcPkg
progdb'
progdb''
verbosity

-- Note that we added the user-supplied program locations and args
-- for /all/ programs, not just those for the compiler prog and
-- compiler-related utils. In principle we don't know which programs
-- the compiler will configure (and it does vary between compilers).
-- We do know however that the compiler will only configure the
-- programs it cares about, and those are the ones we monitor here.
monitorFiles (programsMonitorFiles progdb'')
monitorFiles (programsMonitorFiles progdb''')

-- Note: There is currently a bug here: we are dropping unconfigured
-- programs from the 'ProgramDb' when we re-use the cache created by
Expand Down
11 changes: 11 additions & 0 deletions changelog.d/pr-10790
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Prepend the global extra paths to the `ProgramDb` sooner
packages: cabal-install
prs: #10790
issues: #9800
significance: significant

description: {

- 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`.

}

0 comments on commit 7ee0d49

Please sign in to comment.