From e11de99a6191314300ecf7c5b38d0b1ced993aed Mon Sep 17 00:00:00 2001 From: Ian-Woo Kim Date: Wed, 14 Feb 2024 10:15:16 -0800 Subject: [PATCH] Re-revert: Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (#9384) for hadrian built with GHC 9.4 and Cabal HEAD to successfully build GHC. --- Cabal/src/Distribution/Simple/GHC.hs | 10 +++++++++- Cabal/src/Distribution/Simple/GHCJS.hs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index e71c20d47bc..c96e520bb47 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -720,12 +720,20 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do comp = compiler lbi platform = hostPlatform lbi mbWorkDir = mbWorkDirLBI lbi - vanillaArgs = + vanillaArgs0 = (Internal.componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi)) `mappend` mempty { ghcOptMode = toFlag GhcModeAbiHash , ghcOptInputModules = toNubListR $ exposedModules lib } + vanillaArgs = + -- Package DBs unnecessary, and break ghc-cabal. See #3633 + -- BUT, put at least the global database so that 7.4 doesn't + -- break. + vanillaArgs0 + { ghcOptPackageDBs = [GlobalPackageDB] + , ghcOptPackages = mempty + } sharedArgs = vanillaArgs `mappend` mempty diff --git a/Cabal/src/Distribution/Simple/GHCJS.hs b/Cabal/src/Distribution/Simple/GHCJS.hs index 973230ee3c7..e1aec70a096 100644 --- a/Cabal/src/Distribution/Simple/GHCJS.hs +++ b/Cabal/src/Distribution/Simple/GHCJS.hs @@ -1768,12 +1768,20 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do comp = compiler lbi platform = hostPlatform lbi mbWorkDir = mbWorkDirLBI lbi - vanillaArgs = + vanillaArgs0 = (componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi)) `mappend` mempty { ghcOptMode = toFlag GhcModeAbiHash , ghcOptInputModules = toNubListR $ exposedModules lib } + vanillaArgs = + -- Package DBs unnecessary, and break ghc-cabal. See #3633 + -- BUT, put at least the global database so that 7.4 doesn't + -- break. + vanillaArgs0 + { ghcOptPackageDBs = [GlobalPackageDB] + , ghcOptPackages = mempty + } sharedArgs = vanillaArgs `mappend` mempty