-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cabal fix for ghc-options -fplugin in ghc >=9.6.3 (#2101)
* Cabal fix for ghc-options -fplugin in ghc >=9.6.3 Include haskell/cabal#9384 to fix #2096 * Add test * Patch does not work for GHC head and should not be needed soon * Disable broken test * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Disable test for ghc that polysemy does not support * More cases where plugin test is broken * More cases where plugin test is broken * Add missing haskellLib arg
- Loading branch information
1 parent
52a99ff
commit 9392cb0
Showing
6 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
diff --git a/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs b/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs | ||
index 9d653f858..1fbd15318 100644 | ||
--- a/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs | ||
+++ b/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs | ||
@@ -1861,18 +1861,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do | ||
libBi = libBuildInfo lib | ||
comp = compiler lbi | ||
platform = hostPlatform lbi | ||
- vanillaArgs0 = | ||
+ vanillaArgs = | ||
(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 { | ||
ghcOptDynLinkMode = toFlag GhcDynamicOnly, | ||
ghcOptFPic = toFlag True, | ||
diff --git a/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs b/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs | ||
index c8721746a..dcd5b3230 100644 | ||
--- a/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs | ||
+++ b/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs | ||
@@ -1573,18 +1573,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do | ||
libBi = libBuildInfo lib | ||
comp = compiler lbi | ||
platform = hostPlatform lbi | ||
- vanillaArgs0 = | ||
+ vanillaArgs = | ||
(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 { | ||
ghcOptDynLinkMode = toFlag GhcDynamicOnly, | ||
ghcOptFPic = toFlag True, |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ stdenv, lib, haskellLib, project', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }: | ||
|
||
with lib; | ||
|
||
let | ||
project = project' { | ||
inherit compiler-nix-name evalPackages; | ||
src = testSrc "plugin"; | ||
}; | ||
|
||
packages = project.hsPkgs; | ||
|
||
in recurseIntoAttrs { | ||
ifdInputs = { | ||
inherit (project) plan-nix; | ||
}; | ||
|
||
# Not sure why this breaks for ghc 8.10.7 | ||
meta.disabled = compiler-nix-name == "ghc8107" | ||
# TODO remove once polysemy works with ghc 9.8.1 | ||
|| __compareVersions buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "9.8.1" >= 0 | ||
|| stdenv.hostPlatform.isMusl | ||
|| stdenv.hostPlatform.isGhcjs | ||
|| stdenv.hostPlatform.isWindows | ||
|| (haskellLib.isCrossHost && stdenv.hostPlatform.isAarch64); | ||
build = packages.test.components.library; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module MyLib (someFunc) where | ||
|
||
someFunc :: IO () | ||
someFunc = putStrLn "someFunc" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cabal-version: 3.4 | ||
name: test | ||
version: 0.1.0.0 | ||
build-type: Simple | ||
|
||
library | ||
exposed-modules: MyLib | ||
build-depends: base, polysemy, polysemy-plugin | ||
ghc-options: -Wall -fplugin=Polysemy.Plugin | ||
hs-source-dirs: src | ||
default-language: Haskell2010 |