diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 03a1d45973d848ebcd5e0731f76f0a749a157da6..c32946fe217b86ee6800f8279e3021857a2cde06 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -851,9 +851,16 @@ mkProgramDb cfg initialProgramDb = programDb . userSpecifyPaths (configProgramPaths cfg) . setProgramSearchPath searchpath $ initialProgramDb - searchpath = map ProgramSearchPathDir + searchpath = getProgramSearchPath initialProgramDb ++ + map ProgramSearchPathDir (fromNubList $ configProgramPathExtra cfg) - ++ getProgramSearchPath initialProgramDb + -- Note. We try as much as possible to _prepend_ rather than postpend the extra-prog-path + -- so that we can override the system path. However, in a v2-build, at this point, the "system" path + -- has already been extended by both the built-tools-depends paths, as well as the program-path-extra + -- so for v2 builds adding it again is entirely unnecessary. However, it needs to get added again _anyway_ + -- so as to take effect for v1 builds or standalone calls to Setup.hs + -- In this instance, the lesser evil is to not allow it to override the system path. + -- ----------------------------------------------------------------------------- -- Helper functions for configure diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 06669fb5643fb098c656bc44abebbaf89b50b3d5..631304ca80fe1231f8041085dba8df1d5c0dd6ab 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -3401,7 +3401,10 @@ setupHsScriptOptions (ReadyPackage elab@ElaboratedConfiguredPackage{..}) useDistPref = builddir, useLoggingHandle = Nothing, -- this gets set later useWorkingDir = Just srcdir, - useExtraPathEnv = elabExeDependencyPaths elab, + useExtraPathEnv = elabExeDependencyPaths elab ++ elabProgramPathExtra, + -- note that the above adds the extra-prog-path directly following the elaborated + -- dep paths, so that it overrides the normal path, but _not_ the elaborated extensions + -- for build-tools-depends. useExtraEnvOverrides = dataDirsEnvironmentForPlan distdir plan, useWin32CleanHack = False, --TODO: [required eventually] forceExternalSetupMethod = isParallelBuild,