Skip to content

Commit f906497

Browse files
committed
agda: workaround to build with GHC 9.12
1 parent ffac2e7 commit f906497

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

Formula/a/agda.rb

+23-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ class Agda < Formula
2424
resource "categories" do
2525
url "https://github.com/agda/agda-categories/archive/refs/tags/v0.2.0.tar.gz"
2626
sha256 "a4bf97bf0966ba81553a2dad32f6c9a38cd74b4c86f23f23f701b424549f9015"
27+
28+
# Backport support for stdlib 2.1
29+
patch do
30+
url "https://github.com/agda/agda-categories/commit/ac0d9d27a402305f6774a6343f7a21a229822168.patch?full_index=1"
31+
sha256 "50dc97c97898c825dd4c85fffc8452dc3e61a7871aa907d65b1711e5642c05fc"
32+
end
2733
end
2834

2935
resource "agda2hs" do
@@ -78,7 +84,21 @@ class Agda < Formula
7884
uses_from_macos "zlib"
7985

8086
def install
81-
cabal_args = std_cabal_v2_args.reject { |s| s["installdir"] }
87+
# Workaround for GHC 9.12 until official support is available
88+
# Issue ref: https://github.com/agda/agda/issues/7574
89+
ghc912_args = %w[
90+
--allow-newer=Agda:base
91+
--allow-newer=agda-stdlib-utils:base
92+
--allow-newer=agda2hs:base
93+
--allow-newer=agda2hs:filepath
94+
]
95+
# Workaround for https://github.com/agda/agda/commit/e11ae9875470aab7b68b98d9d9574e736dbcaddd
96+
ghc912_args << "--allow-newer=Agda:hashable"
97+
# Workaround to build with GHC 9.12, remove after https://github.com/haskell/aeson/pull/1126
98+
# is merged and available on Hackage or if `aeson` is willing to provide a metadata revision
99+
ghc912_args << "--allow-newer=aeson:ghc-prim,aeson:template-haskell"
100+
101+
cabal_args = ghc912_args + std_cabal_v2_args.reject { |s| s["installdir"] }
82102

83103
system "cabal", "v2-update"
84104
# expose certain packages for building and testing
@@ -89,7 +109,7 @@ def install
89109

90110
# install main Agda library and binaries
91111
system "cabal", "--store-dir=#{libexec}", "v2-install",
92-
"-foptimise-heavily", *std_cabal_v2_args
112+
"--flags=optimise-heavily", *std_cabal_v2_args, *ghc912_args
93113

94114
# install agda2hs helper binary and library,
95115
# relying on the Agda library just installed
@@ -109,7 +129,7 @@ def install
109129
# Issue ref: https://github.com/agda/agda2hs/issues/347
110130
inreplace "agda2hs.cabal", /( base .*&&) < 4\.20,/, "\\1 < 4.21,", build.stable?
111131

112-
system "cabal", "--store-dir=#{libexec}", "v2-install", *std_cabal_v2_args
132+
system "cabal", "--store-dir=#{libexec}", "v2-install", *std_cabal_v2_args, *ghc912_args
113133
end
114134

115135
# generate the standard library's documentation and vim highlighting files

0 commit comments

Comments
 (0)