Skip to content

Commit

Permalink
Merge pull request #203385 from cho-m/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewTestBot authored Jan 7, 2025
2 parents ff229d7 + 4f8274c commit acee665
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 34 deletions.
23 changes: 10 additions & 13 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class GhcAT98 < Formula
desc "Glorious Glasgow Haskell Compilation System"
homepage "https://haskell.org/ghc/"
url "https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-src.tar.xz"
sha256 "e2fb7a7dd7461237d22e8365a83edd9e1a77d2e15d045f3945396845a87781c9"
url "https://downloads.haskell.org/~ghc/9.8.4/ghc-9.8.4-src.tar.xz"
sha256 "17e8188f3c8a5c2f73fb4e35d01032e8dc258835ec876d52c8ad8ee3d24b2fc5"
# We build bundled copies of libffi and GMP so GHC inherits the licenses
license all_of: [
"BSD-3-Clause",
Expand All @@ -16,22 +16,19 @@ class GhcAT98 < Formula
end

bottle do
rebuild 1
sha256 cellar: :any, arm64_sequoia: "2d815b4bf0d5873313ad00c7bcc2c3a8c3a14892edcb76ae87a8abfcb92bc119"
sha256 cellar: :any, arm64_sonoma: "abeced6f03bc0d63eaaa0909167c4cda1585c414e718861ec89aa0f13122a6d5"
sha256 cellar: :any, arm64_ventura: "686beedac05e51b8554a6fbdd44ea4a06b5fc5f73cd18ddb5191dee9d8ed1965"
sha256 cellar: :any, arm64_monterey: "263c6cc8f81369500e6270509468775976987c5557f023126e694c00d7f44ba6"
sha256 cellar: :any, sonoma: "64216a95d4b33e2bde661c2fcadc50dc0bcebf09e4279db09b35b7f71b99c6f6"
sha256 cellar: :any, ventura: "6905add83dbe5b32468bd06c88ba8f34a6d59bffad1b077ea68ddb74507bf1e2"
sha256 cellar: :any, monterey: "a06fc3f77af7df2c5d37e2b2783bcd3174ad1287a939b38c8d6ba2941ee776a1"
sha256 cellar: :any_skip_relocation, x86_64_linux: "a0427565c4f24eac5d9eb39fb0f2bd9440cd52011f1c2621d70a511efa13d58e"
sha256 cellar: :any, arm64_sequoia: "77cf644f73bd7942775f30101b61c4425c9c3d45d8ba5c3af80e6b3c5e689f4a"
sha256 cellar: :any, arm64_sonoma: "1a10ae542525f70b3c308122da20a293f26a80ddb9e60df6d4ce3dc7aa1fa0f7"
sha256 cellar: :any, arm64_ventura: "2a294afb0daafc46a01f07b28ce8b12c99e7cf012636db9e1ec2cad571cb7159"
sha256 cellar: :any, sonoma: "1ef721a935beec2ae8dee98c5114688006fba633e326b8fb539c0c579aea6692"
sha256 cellar: :any, ventura: "cb6edb4b9148cd65d58e0eb460717156a508e30746a9041913fa9d723b7e4021"
sha256 cellar: :any_skip_relocation, x86_64_linux: "062b63708890292cd293ab0e7b836807cf7b37751e6f5717490921b777acb517"
end

keg_only :versioned_formula

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "python@3.12" => :build
depends_on "python@3.13" => :build
depends_on "sphinx-doc" => :build
depends_on "xz" => :build

Expand Down Expand Up @@ -111,7 +108,7 @@ def install
ENV["CC"] = ENV["ac_cv_path_CC"] = OS.linux? ? "cc" : ENV.cc
ENV["CXX"] = ENV["ac_cv_path_CXX"] = OS.linux? ? "c++" : ENV.cxx
ENV["LD"] = "ld"
ENV["PYTHON"] = which("python3.12")
ENV["PYTHON"] = which("python3.13")

binary = buildpath/"binary"
resource("binary").stage do
Expand Down
60 changes: 39 additions & 21 deletions Formula/h/haskell-language-server.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
class HaskellLanguageServer < Formula
desc "Integration point for ghcide and haskell-ide-engine. One IDE to rule them all"
homepage "https://github.com/haskell/haskell-language-server"
url "https://github.com/haskell/haskell-language-server/releases/download/2.9.0.1/haskell-language-server-2.9.0.1-src.tar.gz"
sha256 "bdcdca4d4ec2a6208e3a32309ad88f6ebc51bdaef44cc59b3c7c004699d1f7bd"
license "Apache-2.0"
revision 1
head "https://github.com/haskell/haskell-language-server.git", branch: "master"

stable do
url "https://github.com/haskell/haskell-language-server/releases/download/2.9.0.1/haskell-language-server-2.9.0.1-src.tar.gz"
sha256 "bdcdca4d4ec2a6208e3a32309ad88f6ebc51bdaef44cc59b3c7c004699d1f7bd"

# Backport support for newer GHC 9.8
# Ref: https://github.com/haskell/haskell-language-server/commit/6d0a6f220226fe6c1cb5b6533177deb55e755b0b
patch :DATA
end

# we need :github_latest here because otherwise
# livecheck picks up spurious non-release tags
livecheck do
Expand All @@ -14,14 +22,12 @@ class HaskellLanguageServer < Formula
end

bottle do
sha256 cellar: :any_skip_relocation, arm64_sequoia: "e50ed5add3e104d152871aa41670d5793907cd835986735dc3cc0c7e139b90b2"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "46b1067ee77c8d2741f9e26744786cabc80e62a6b29befcaaf38058067953102"
sha256 cellar: :any_skip_relocation, arm64_ventura: "56df7ae9fc11ea8d19ccc3adff4a9fd7844f8e15200e5469fa90815b8c8a89b3"
sha256 cellar: :any_skip_relocation, arm64_monterey: "a11af473d8a8eaea5159c5fa4827b59551ff705bca1d057d75aa6ae8f40d2a3d"
sha256 cellar: :any_skip_relocation, sonoma: "e1e671aa10750b612d12a45f815a35416998662188e954d80a16a55377d9f50e"
sha256 cellar: :any_skip_relocation, ventura: "739cbff9e9abd601ffe31628417f6a0cea26a7c05e70b384bf40b2765f40d9a9"
sha256 cellar: :any_skip_relocation, monterey: "ecfbbe1f719963f7e3f45fe27e14ca98b07218525f8c23af886e67450a9a6242"
sha256 cellar: :any_skip_relocation, x86_64_linux: "afbb8f67dc62f0f72ebbbc7ce88e10c3e5a65abac2df6d2f86132676f15041d6"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "3ca04aceddff878e084ee95e1b350679f6496ef59f3fa8f888022530241e1a8d"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "8e465529fa959635d64b58f489e565b316530246cdb17fe77caaf9a047958b23"
sha256 cellar: :any_skip_relocation, arm64_ventura: "a4b7056eb268074e77b59c6cd162a4d56b30a711d7504d9b7fad0068df528e21"
sha256 cellar: :any_skip_relocation, sonoma: "feb62de0788a945aa9effc9cf8309a3af9781c2960311c0d09dc403435611e21"
sha256 cellar: :any_skip_relocation, ventura: "5bd0b38d098fff1453dd0fafb897b23ea908872b90df89ff69594c52b7655ba5"
sha256 cellar: :any_skip_relocation, x86_64_linux: "37b70a3d3a35c2e55e5227d37f13a136cfa2b191e32917b7feaeeeffa999553a"
end

depends_on "cabal-install" => [:build, :test]
Expand All @@ -33,16 +39,17 @@ class HaskellLanguageServer < Formula
uses_from_macos "zlib"

def ghcs
deps.map(&:to_formula)
.select { |f| f.name.match? "ghc" }
deps.filter_map { |dep| dep.to_formula if dep.name.match? "ghc" }
.sort_by(&:version)
end

def install
# Backport newer index-state to get `hashable` fix needed to build on ARM Monterey
# Ref: https://github.com/haskell/haskell-language-server/commit/376f7f1802298d23aff6aa94592cd46c4d68e61b
# Backport newer index-state for GHC 9.8.4 support in ghc-lib-parser.
# We use the timestamp of r1 revision to avoid latter part of commit
# Ref: https://github.com/haskell/haskell-language-server/commit/25c5d82ce09431a1b53dfa1784a276a709f5e479
# Ref: https://hackage.haskell.org/package/ghc-lib-parser-9.8.4.20241130/revisions/
# TODO: Remove on the next release
inreplace "cabal.project", ": 2024-06-13T17:12:34Z", ": 2024-06-29T00:00:00Z" if build.stable?
inreplace "cabal.project", ": 2024-06-13T17:12:34Z", ": 2024-12-04T16:29:32Z" if build.stable?

system "cabal", "v2-update"

Expand All @@ -69,22 +76,33 @@ def caveats
end

test do
valid_hs = testpath/"valid.hs"
valid_hs.write <<~HASKELL
(testpath/"valid.hs").write <<~HASKELL
f :: Int -> Int
f x = x + 1
HASKELL

invalid_hs = testpath/"invalid.hs"
invalid_hs.write <<~HASKELL
(testpath/"invalid.hs").write <<~HASKELL
f :: Int -> Int
HASKELL

ghcs.each do |ghc|
with_env(PATH: "#{ghc.bin}:#{ENV["PATH"]}") do
assert_match "Completed (1 file worked, 1 file failed)",
shell_output("#{bin}/haskell-language-server-#{ghc.version.major_minor} #{testpath}/*.hs 2>&1", 1)
hls = bin/"haskell-language-server-#{ghc.version.major_minor}"
assert_match "Completed (1 file worked, 1 file failed)", shell_output("#{hls} #{testpath}/*.hs 2>&1", 1)
end
end
end
end

__END__
--- a/ghcide/src/Development/IDE/GHC/Compat/Core.hs
+++ b/ghcide/src/Development/IDE/GHC/Compat/Core.hs
@@ -674,7 +674,7 @@ initObjLinker env =
loadDLL :: HscEnv -> String -> IO (Maybe String)
loadDLL env str = do
res <- GHCi.loadDLL (GHCi.hscInterp env) str
-#if MIN_VERSION_ghc(9,11,0)
+#if MIN_VERSION_ghc(9,11,0) || (MIN_VERSION_ghc(9, 8, 3) && !MIN_VERSION_ghc(9, 9, 0))
pure $
case res of
Left err_msg -> Just err_msg

0 comments on commit acee665

Please sign in to comment.