Skip to content

Commit

Permalink
Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (
Browse files Browse the repository at this point in the history
#9384)

* Revert #3639 (Don't pass -package-db and -package flags to --abi-hash)

With ghc>=9.6 `ghc --abi-hash` initialises the plugins so it will fail
if a cabal file specifies `ghc-options: -fplugin=Foo`.

Closes: #9375

* Also revert in GHC.hs

---------

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 01cfac0)

# Conflicts:
#	Cabal/src/Distribution/Simple/GHC.hs
#	Cabal/src/Distribution/Simple/GHCJS.hs
  • Loading branch information
andreabedini authored and mergify[bot] committed Dec 8, 2023
1 parent 5d97fcf commit d8bc902
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,7 @@ libAbiHash :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO String
libAbiHash verbosity _pkg_descr lbi lib clbi = do
let
<<<<<<< HEAD
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
Expand Down Expand Up @@ -1893,6 +1894,43 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
| withSharedLib lbi = sharedArgs
| withProfLib lbi = profArgs
| otherwise = error "libAbiHash: Can't find an enabled library way"
=======
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
vanillaArgs =
(componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi))
`mappend` mempty
{ ghcOptMode = toFlag GhcModeAbiHash
, ghcOptInputModules = toNubListR $ exposedModules lib
}
sharedArgs =
vanillaArgs
`mappend` mempty
{ ghcOptDynLinkMode = toFlag GhcDynamicOnly
, ghcOptFPic = toFlag True
, ghcOptHiSuffix = toFlag "dyn_hi"
, ghcOptObjSuffix = toFlag "dyn_o"
, ghcOptExtra = hcSharedOptions GHC libBi
}
profArgs =
vanillaArgs
`mappend` mempty
{ ghcOptProfilingMode = toFlag True
, ghcOptProfilingAuto =
Internal.profDetailLevelFlag
True
(withProfLibDetail lbi)
, ghcOptHiSuffix = toFlag "p_hi"
, ghcOptObjSuffix = toFlag "p_o"
, ghcOptExtra = hcProfOptions GHC libBi
}
ghcArgs
| withVanillaLib lbi = vanillaArgs
| withSharedLib lbi = sharedArgs
| withProfLib lbi = profArgs
| otherwise = error "libAbiHash: Can't find an enabled library way"
>>>>>>> 01cfac0e6 (Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (#9384))

(ghcProg, _) <- requireProgram verbosity ghcProgram (withPrograms lbi)
hash <- getProgramInvocationOutput verbosity
Expand Down
38 changes: 38 additions & 0 deletions Cabal/src/Distribution/Simple/GHCJS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,7 @@ libAbiHash :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO String
libAbiHash verbosity _pkg_descr lbi lib clbi = do
let
<<<<<<< HEAD
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
Expand Down Expand Up @@ -1605,6 +1606,43 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
| withSharedLib lbi = sharedArgs
| withProfLib lbi = profArgs
| otherwise = error "libAbiHash: Can't find an enabled library way"
=======
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
vanillaArgs =
(componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi))
`mappend` mempty
{ ghcOptMode = toFlag GhcModeAbiHash
, ghcOptInputModules = toNubListR $ exposedModules lib
}
sharedArgs =
vanillaArgs
`mappend` mempty
{ ghcOptDynLinkMode = toFlag GhcDynamicOnly
, ghcOptFPic = toFlag True
, ghcOptHiSuffix = toFlag "js_dyn_hi"
, ghcOptObjSuffix = toFlag "js_dyn_o"
, ghcOptExtra = hcSharedOptions GHC libBi
}
profArgs =
vanillaArgs
`mappend` mempty
{ ghcOptProfilingMode = toFlag True
, ghcOptProfilingAuto =
Internal.profDetailLevelFlag
True
(withProfLibDetail lbi)
, ghcOptHiSuffix = toFlag "js_p_hi"
, ghcOptObjSuffix = toFlag "js_p_o"
, ghcOptExtra = hcProfOptions GHC libBi
}
ghcArgs
| withVanillaLib lbi = vanillaArgs
| withSharedLib lbi = sharedArgs
| withProfLib lbi = profArgs
| otherwise = error "libAbiHash: Can't find an enabled library way"
>>>>>>> 01cfac0e6 (Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (#9384))

(ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi)
hash <- getProgramInvocationOutput verbosity
Expand Down

0 comments on commit d8bc902

Please sign in to comment.