Skip to content

Commit

Permalink
Merge pull request Homebrew#203246 from Homebrew/[email protected]
Browse files Browse the repository at this point in the history
[email protected] 9.10.1 (new formula)
  • Loading branch information
BrewTestBot authored Jan 5, 2025
2 parents 2053f3b + f3f262c commit b52719a
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/[email protected]

This file was deleted.

163 changes: 163 additions & 0 deletions Formula/g/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
class GhcAT910 < Formula
desc "Glorious Glasgow Haskell Compilation System"
homepage "https://haskell.org/ghc/"
url "https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-src.tar.xz"
sha256 "bf386a302d4ee054791ffd51748900f15d71760fd199157922d120cc1f89e2f7"
# We build bundled copies of libffi and GMP so GHC inherits the licenses
license all_of: [
"BSD-3-Clause",
"MIT", # libffi
any_of: ["LGPL-3.0-or-later", "GPL-2.0-or-later"], # GMP
]

livecheck do
url "https://www.haskell.org/ghc/download.html"
regex(/href=.*?download[._-]ghc[._-][^"' >]+?\.html[^>]*?>\s*?v?(9\.10(?:\.\d+)+)\s*?</i)
end

bottle do
sha256 cellar: :any, arm64_sequoia: "ec9bf60301efe6176480908497e6bbcf760c8933cb6e7e5f37ebb974511503ad"
sha256 cellar: :any, arm64_sonoma: "6adabdb9471ae60464844e605ea1b125072093c3545bbb6be58c97e068e4b179"
sha256 cellar: :any, arm64_ventura: "7873d62ffe85f56f79253dd01207e5d2ff9d517327908d24df0cddf0507a894d"
sha256 cellar: :any, sonoma: "468cb6b1d315ee7666776732ff81810ef758fafab73cb9e4625f2eae4eec6b53"
sha256 cellar: :any, ventura: "bdb6eb7758ff9cbe21ddd04b686adde591cccf4cc783f61f6dbd748d1d717d51"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7094724850adb80577444deb76d26cd865c71f45d6afaae2f92cb9809cf7fd76"
end

keg_only :versioned_formula

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "[email protected]" => :build
depends_on "sphinx-doc" => :build
depends_on "xz" => :build

uses_from_macos "m4" => :build
uses_from_macos "ncurses"

# Build uses sed -r option, which is not available in Catalina shipped sed.
on_catalina :or_older do
depends_on "gnu-sed" => :build
end

on_linux do
depends_on "gmp" => :build
end

# A binary of ghc is needed to bootstrap ghc
resource "binary" do
on_macos do
on_arm do
url "https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-aarch64-apple-darwin.tar.xz"
sha256 "67be089dedbe599d911efd8f82e4f9a19225761a3872be74dfd4b5a557fb8e1a"
end
on_intel do
url "https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-x86_64-apple-darwin.tar.xz"
sha256 "64e8cca6310443cd6de8255edcf391d937829792e701167f7e5fb234f7150078"
end
end
on_linux do
on_arm do
url "https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-aarch64-deb10-linux.tar.xz"
sha256 "9a3776fd8dc02f95b751f0e44823d6727dea2c212857e2c5c5f6a38a034d1575"
end
on_intel do
url "https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-x86_64-ubuntu20_04-linux.tar.xz"
sha256 "a65a4726203c606b58a7f6b714a576e7d81390158c8afa0dece3841a4c602de2"
end
end
end

resource "cabal-install" do
on_macos do
on_arm do
url "https://downloads.haskell.org/~cabal/cabal-install-3.12.1.0/cabal-install-3.12.1.0-aarch64-darwin.tar.xz"
sha256 "9c165ca9a2e593b12dbb0eca92c0b04f8d1c259871742d7e9afc352364fe7a3f"
end
on_intel do
url "https://downloads.haskell.org/~cabal/cabal-install-3.12.1.0/cabal-install-3.12.1.0-x86_64-darwin.tar.xz"
sha256 "e89392429f59bbcfaf07e1164e55bc63bba8e5c788afe43c94e00b515c1578af"
end
end
on_linux do
on_arm do
url "https://downloads.haskell.org/~cabal/cabal-install-3.12.1.0/cabal-install-3.12.1.0-aarch64-linux-deb10.tar.xz"
sha256 "c01f2e0b3ba1fe4104cf2933ee18558a9b81d85831a145e8aba33fa172c7c618"
end
on_intel do
url "https://downloads.haskell.org/~cabal/cabal-install-3.12.1.0/cabal-install-3.12.1.0-x86_64-linux-ubuntu20_04.tar.xz"
sha256 "3724f2aa22f330c5e6605978f3dd9adee4e052866321a8dd222944cd178c3c24"
end
end
end

# Backport fix to avoid unnecessary `alex` dependency
patch do
url "https://gitlab.haskell.org/ghc/ghc/-/commit/aba2c9d4728262cd9a2d711eded9050ac131c6c1.diff"
sha256 "152cd2711a7e103bbf0526dc62e51b437e6c60e26149f2cd50ccafaa057316ce"
end

def install
# ENV.cc and ENV.cxx return specific compiler versions on Ubuntu, e.g.
# gcc-11 and g++-11 on Ubuntu 22.04. Using such values effectively causes
# the bottle (binary package) to only run on systems where gcc-11 and g++-11
# binaries are available. This breaks on many systems including Arch Linux,
# Fedora and Ubuntu 24.04, as they provide g** but not g**-11 specifically.
#
# The workaround here is to hard-code both CC and CXX on Linux.
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"] = ENV["MergeObjsCmd"] = "ld"
ENV["PYTHON"] = which("python3.13")

binary = buildpath/"binary"
resource("binary").stage do
binary_args = []
if OS.linux?
binary_args << "--with-gmp-includes=#{Formula["gmp"].opt_include}"
binary_args << "--with-gmp-libraries=#{Formula["gmp"].opt_lib}"
end

system "./configure", "--prefix=#{binary}", *binary_args
ENV.deparallelize { system "make", "install" }
end

ENV.prepend_path "PATH", binary/"bin"
# Build uses sed -r option, which is not available in Catalina shipped sed.
ENV.prepend_path "PATH", Formula["gnu-sed"].libexec/"gnubin" if OS.mac? && MacOS.version <= :catalina

resource("cabal-install").stage { (binary/"bin").install "cabal" }
system "cabal", "v2-update"

args = []
if OS.mac?
# https://gitlab.haskell.org/ghc/ghc/-/issues/22595#note_468423
args << "--with-ffi-libraries=#{MacOS.sdk_path_if_needed}/usr/lib"
args << "--with-ffi-includes=#{MacOS.sdk_path_if_needed}/usr/include/ffi"
args << "--with-system-libffi"
end

system "./configure", "--prefix=#{prefix}", "--disable-numa", "--with-intree-gmp", *args
hadrian_args = %W[
-j#{ENV.make_jobs}
--prefix=#{prefix}
--flavour=release
--docs=no-sphinx-pdfs
]
# Let hadrian handle its own parallelization
ENV.deparallelize { system "hadrian/build", "install", *hadrian_args }

bash_completion.install "utils/completion/ghc.bash" => "ghc"
(lib/"ghc-#{version}/lib/package.conf.d/package.cache").unlink
(lib/"ghc-#{version}/lib/package.conf.d/package.cache.lock").unlink
end

def post_install
system bin/"ghc-pkg", "recache"
end

test do
(testpath/"hello.hs").write('main = putStrLn "Hello Homebrew"')
assert_match "Hello Homebrew", shell_output("#{bin}/runghc hello.hs")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"fpc",
"ghc",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
Expand Down

0 comments on commit b52719a

Please sign in to comment.