Skip to content

Commit

Permalink
Merge pull request #204219 from Homebrew/aeson-workaround
Browse files Browse the repository at this point in the history
cgrep hpack shellcheck skylighting texmath: workaround to build with GHC 9.12
  • Loading branch information
BrewTestBot authored Jan 14, 2025
2 parents f936658 + e1c479a commit cc54953
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Formula/c/cgrep.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Cgrep < Formula
desc "Context-aware grep for source code"
homepage "https://github.com/awgn/cgrep"
# TODO: Check if `rawfilepath` workaround and `aeson` allow-newer workaround can be removed
url "https://github.com/awgn/cgrep/archive/refs/tags/v8.1.2.tar.gz"
sha256 "1b705013a432e6ea90247f03e4cfeceb5a37f795d879178e4bf0085ce6191316"
license "GPL-2.0-or-later"
Expand Down Expand Up @@ -42,6 +43,9 @@ def install
end
# Help resolver pick package versions compatible with newer GHC
constraints = ["--constraint=async>=2"]
# 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
constraints << "--allow-newer=aeson:ghc-prim,aeson:template-haskell"

system "cabal", "v2-update"
system "cabal", "v2-install", *constraints, *std_cabal_v2_args
Expand Down
7 changes: 6 additions & 1 deletion Formula/h/hpack.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Hpack < Formula
desc "Modern format for Haskell packages"
homepage "https://github.com/sol/hpack"
# TODO: Check if `aeson` allow-newer workaround can be removed
url "https://github.com/sol/hpack/archive/refs/tags/0.37.0.tar.gz"
sha256 "5d292d70744435d67586f9a8a759debbf160cb70a069a8d65403f123fac84091"
license "MIT"
Expand All @@ -23,8 +24,12 @@ class Hpack < Formula
uses_from_macos "zlib"

def install
# 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
args = ["--allow-newer=aeson:ghc-prim,aeson:template-haskell"]

system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
system "cabal", "v2-install", *args, *std_cabal_v2_args
end

# Testing hpack is complicated by the fact that it is not guaranteed
Expand Down
7 changes: 6 additions & 1 deletion Formula/s/shellcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Shellcheck < Formula
head "https://github.com/koalaman/shellcheck.git", branch: "master"

stable do
# TODO: Check if `aeson` allow-newer workaround can be removed
url "https://github.com/koalaman/shellcheck/archive/refs/tags/v0.10.0.tar.gz"
sha256 "149ef8f90c0ccb8a5a9e64d2b8cdd079ac29f7d2f5a263ba64087093e9135050"

Expand All @@ -31,8 +32,12 @@ class Shellcheck < Formula
depends_on "pandoc" => :build

def install
# 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
args = ["--allow-newer=aeson:ghc-prim,aeson:template-haskell"]

system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args
system "cabal", "v2-install", *args, *std_cabal_v2_args
system "./manpage"
man1.install "shellcheck.1"
end
Expand Down
9 changes: 7 additions & 2 deletions Formula/s/skylighting.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Skylighting < Formula
desc "Flexible syntax highlighter using KDE XML syntax descriptions"
homepage "https://github.com/jgm/skylighting"
# TODO: Check if `aeson` allow-newer workaround can be removed
url "https://github.com/jgm/skylighting/archive/refs/tags/0.14.6.tar.gz"
sha256 "73417bbc85c1e11fb2bdaf565629e6bb78c71694d70d436bd5dcbc5b906507e7"
license "GPL-2.0-or-later"
Expand All @@ -21,18 +22,22 @@ class Skylighting < Formula
uses_from_macos "zlib"

def install
# 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
args = ["--allow-newer=aeson:ghc-prim,aeson:template-haskell"]

system "cabal", "v2-update"

# moving this file aside during the first package's compilation avoids
# spurious errors about undeclared autogenerated modules
mv buildpath/"skylighting/skylighting.cabal", buildpath/"skylighting.cabal.temp-loc"
system "cabal", "v2-install", buildpath/"skylighting-core", "-fexecutable", *std_cabal_v2_args
system "cabal", "v2-install", buildpath/"skylighting-core", "--flags=executable", *args, *std_cabal_v2_args
mv buildpath/"skylighting.cabal.temp-loc", buildpath/"skylighting/skylighting.cabal"

cd "skylighting" do
system bin/"skylighting-extract", buildpath/"skylighting-core/xml"
end
system "cabal", "v2-install", buildpath/"skylighting", "-fexecutable", *std_cabal_v2_args
system "cabal", "v2-install", buildpath/"skylighting", "--flags=executable", *args, *std_cabal_v2_args
end

test do
Expand Down
9 changes: 7 additions & 2 deletions Formula/t/texmath.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Texmath < Formula
desc "Haskell library for converting LaTeX math to MathML"
homepage "https://johnmacfarlane.net/texmath.html"
# TODO: Check if `aeson` allow-newer workaround can be removed
url "https://hackage.haskell.org/package/texmath-0.12.8.13/texmath-0.12.8.13.tar.gz"
sha256 "bb51a51f69d02c7fed411739d61bff62d56865719542bba995c66e5abe96e409"
license "GPL-2.0-or-later"
Expand All @@ -19,11 +20,15 @@ class Texmath < Formula
depends_on "ghc" => :build

def install
# 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
args = ["--allow-newer=aeson:ghc-prim,aeson:template-haskell"]

system "cabal", "v2-update"
system "cabal", "v2-install", *std_cabal_v2_args, "-fexecutable"
system "cabal", "v2-install", "--flags=executable", *args, *std_cabal_v2_args
end

test do
assert_match "<mn>2</mn>", pipe_output(bin/"texmath", "a^2 + b^2 = c^2")
assert_match "<mn>2</mn>", pipe_output(bin/"texmath", "a^2 + b^2 = c^2", 0)
end
end

0 comments on commit cc54953

Please sign in to comment.