Repository navigation
Conversation
5 of 6 tasks
1 of 2 tasks
zlonast
approved these changes
Nov 14, 2026
2 tasks done
sheaf
force-pushed
the
b-e-p
branch
2 times, most recently
from
December 3, 2026 20:12
8df355d to
6499b1d
Compare
Options given in more specific stanzas within a project file now consistently override more general options, and command line options have the last say in the matter. The configuration as a whole now follows the order: - cabal/config - cabal.project - cabal.project.freeze - cabal.project.local - command line arguments with later options overriding earlier ones. Then, within a single project file: - settings in a "package *" stanza - top-level settings - settings in a "package <pkg-name>" stanza
The program search path of each package started from the search path of the compiler's ProgramDb, which leaked the extra-prog-path of the local packages.
The program search path used to find programs is now consistently structured to avoid duplicates and enforce the following ordering: (B) Programs specified in `build-tool-depends` (E) Programs found from `--extra-prog-path` (P) Fallback search on `PATH`. See Note [Program search paths] in Distribution.Simple.Configure. Removes the duplicate search path entries reported in haskell#12544.
The check in Distribution.Client.ProjectConfig.checkBadPerPackageCompilerPaths
made sure that one didn't try to change the compiler (or hc-pkg) on a
per-package basis, as that isn't valid. This patch extends that treatment
to other compiler toolchain programs (such as the C compiler). Other
programs that come with GHC, such as hsc2hs or haddock, are merely found
next to the GHC executable but are not part of the toolchain proper.
Other (related) changes:
- The locations given by the user are now taken into account when
configuring the toolchain programs at the project level: Cabal's
'configCompilerProgDb' is split into 'addCompilerPrograms' and
'configCompilerPrograms', so that user locations can be recorded in
between.
- The compiler ProgramDb shared by all packages now only retains
configured programs, so that the first run behaves the same as when
the plan is read back from the cache.
- 'cabal install --with-gcc=<..> foo' now works as expected, with the
GCC setting taken to be a global setting and not a per-package
override (which would be invalid).
- The locations of the other programs given at the top level of the
project only apply to local packages: they no longer reach the
dependencies through the compiler ProgramDb.
Fixes haskell#12694.
The programs that come with the compiler but are not part of its toolchain (e.g. hsc2hs, haddock) are configured once for the whole project, but can now be overridden on a per-package basis (instead of silently ignoring e.g. hsc2hs-location). If the program specified on a per-package basis matches the project level one, we re-use it (to avoid pointlessly reconfiguring); otherwise we reconfigure. Fixes haskell#12535.
When running the solver, we now make sure that configuration intended for local packages does not apply to other packages in the project. This makes the solver consistent with plan elaboration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reworks the precedence of all configuration options. The global Cabal user configuration is overridden by
cabal.project, which in turn is overridden by the freeze file, thencabal.project.local, then the command-line arguments.Within a single project file,
package *is overridden by top-level options which is then overriden bypackage pkg.For program search paths, I reworked it completely as explained in Note [Program search paths]:
--with-PROG=<...>ghc-pkgnext to where we foundghc--extra-prog-pathPATHTickets fixed: #12535, #12694. Progress towards #12544.
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR: