Skip to content

Commit

Permalink
agda: workaround to build with GHC 9.12
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Jan 14, 2025
1 parent ffac2e7 commit f906497
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Formula/a/agda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class Agda < Formula
resource "categories" do
url "https://github.com/agda/agda-categories/archive/refs/tags/v0.2.0.tar.gz"
sha256 "a4bf97bf0966ba81553a2dad32f6c9a38cd74b4c86f23f23f701b424549f9015"

# Backport support for stdlib 2.1
patch do
url "https://github.com/agda/agda-categories/commit/ac0d9d27a402305f6774a6343f7a21a229822168.patch?full_index=1"
sha256 "50dc97c97898c825dd4c85fffc8452dc3e61a7871aa907d65b1711e5642c05fc"
end
end

resource "agda2hs" do
Expand Down Expand Up @@ -78,7 +84,21 @@ class Agda < Formula
uses_from_macos "zlib"

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

cabal_args = ghc912_args + std_cabal_v2_args.reject { |s| s["installdir"] }

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

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

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

system "cabal", "--store-dir=#{libexec}", "v2-install", *std_cabal_v2_args
system "cabal", "--store-dir=#{libexec}", "v2-install", *std_cabal_v2_args, *ghc912_args
end

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

0 comments on commit f906497

Please sign in to comment.