ghc 9.4.3
parent
54b5db3156
commit
5827ee0773
|
@ -0,0 +1 @@
|
|||
../Formula/ghc.rb
|
|
@ -1,14 +1,15 @@
|
|||
class Ghc < Formula
|
||||
desc "Glorious Glasgow Haskell Compilation System"
|
||||
homepage "https://haskell.org/ghc/"
|
||||
url "https://downloads.haskell.org/~ghc/9.2.4/ghc-9.2.4-src.tar.xz"
|
||||
sha256 "15213888064a0ec4e7723d075f31b87a678ce0851773d58b44ef7aa3de996458"
|
||||
url "https://downloads.haskell.org/~ghc/9.4.3/ghc-9.4.3-src.tar.xz"
|
||||
sha256 "eaf63949536ede50ee39179f2299d5094eb9152d87cc6fb2175006bc98e8905a"
|
||||
# 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
|
||||
]
|
||||
head "https://gitlab.haskell.org/ghc/ghc.git", branch: "master"
|
||||
|
||||
livecheck do
|
||||
url "https://www.haskell.org/ghc/download.html"
|
||||
|
@ -25,7 +26,9 @@ class Ghc < Formula
|
|||
sha256 cellar: :any_skip_relocation, x86_64_linux: "66de55e420c039535422aed4c7803285faedf5292dd2385f6b7d7bcc5d899d94"
|
||||
end
|
||||
|
||||
depends_on "python@3.10" => :build
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
depends_on "python@3.11" => :build
|
||||
depends_on "sphinx-doc" => :build
|
||||
depends_on macos: :catalina
|
||||
|
||||
|
@ -36,47 +39,61 @@ class Ghc < Formula
|
|||
depends_on "gmp" => :build
|
||||
end
|
||||
|
||||
# GHC 9.2.4 user manual recommend use LLVM 9 through 12
|
||||
# https://downloads.haskell.org/~ghc/9.2.4/docs/html/users_guide/9.2.4-notes.html
|
||||
# GHC 9.4.3 user manual recommend use LLVM 9 through 13
|
||||
# https://downloads.haskell.org/~ghc/9.4.3/docs/users_guide/9.4.3-notes.html
|
||||
# and we met some unknown issue w/ LLVM 13 before https://gitlab.haskell.org/ghc/ghc/-/issues/20559
|
||||
# so conservatively use LLVM 12 here
|
||||
on_arm do
|
||||
depends_on "llvm@12"
|
||||
end
|
||||
|
||||
# https://www.haskell.org/ghc/download_ghc_9_0_2.html#macosx_x86_64
|
||||
# "This is a distribution for Mac OS X, 10.7 or later."
|
||||
# A binary of ghc is needed to bootstrap ghc
|
||||
resource "binary" do
|
||||
on_macos do
|
||||
on_intel do
|
||||
url "https://downloads.haskell.org/~ghc/9.0.2/ghc-9.0.2-x86_64-apple-darwin.tar.xz"
|
||||
sha256 "e1fe990eb987f5c4b03e0396f9c228a10da71769c8a2bc8fadbc1d3b10a0f53a"
|
||||
end
|
||||
on_arm do
|
||||
url "https://downloads.haskell.org/~ghc/9.0.2/ghc-9.0.2-aarch64-apple-darwin.tar.xz"
|
||||
sha256 "b1fcab17fe48326d2ff302d70c12bc4cf4d570dfbbce68ab57c719cfec882b05"
|
||||
url "https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-aarch64-apple-darwin.tar.xz"
|
||||
sha256 "b060ad093e0d86573e01b3d1fd622d4892f8d8925cbb7d75a67a01d2a4f27f18"
|
||||
end
|
||||
on_intel do
|
||||
url "https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-apple-darwin.tar.xz"
|
||||
sha256 "6c46f5003f29d09802d572a7c5fabf6c1f91714a474967a5415b15df77fdcd90"
|
||||
end
|
||||
end
|
||||
on_linux do
|
||||
url "https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-ubuntu20.04-linux.tar.xz"
|
||||
sha256 "be1ca5b2864880d7c3623c51f2c2ca773e380624929bf0be8cfadbdb7f4b7154"
|
||||
end
|
||||
end
|
||||
|
||||
resource "cabal-install" do
|
||||
on_macos do
|
||||
on_arm do
|
||||
url "https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-aarch64-darwin.tar.xz"
|
||||
sha256 "f75b129c19cf3aa88cf9885cbf5da6d16f9972c7f770c528ca765b9f0563ada3"
|
||||
end
|
||||
on_intel do
|
||||
url "https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-x86_64-darwin.tar.xz"
|
||||
sha256 "f5ff69127b0e596b0d7895a2b0b383543aa92ae46d9b1b28f2868d2a97ed0de9"
|
||||
end
|
||||
end
|
||||
on_linux do
|
||||
url "https://downloads.haskell.org/~ghc/9.0.2/ghc-9.0.2-x86_64-ubuntu20.04-linux.tar.xz"
|
||||
sha256 "a0ff9893618d597534682123360e7c80f97441f0e49f261828416110e8348ea0"
|
||||
url "https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-x86_64-linux-deb10.tar.xz"
|
||||
sha256 "c71a1a46fd42d235bb86be968660815c24950e5da2d1ff4640da025ab520424b"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
ENV["CC"] = ENV.cc
|
||||
ENV["LD"] = "ld"
|
||||
ENV["PYTHON"] = which("python3.10")
|
||||
# Work around build failure: fatal error: 'ffitarget_arm64.h' file not found
|
||||
# Issue ref: https://gitlab.haskell.org/ghc/ghc/-/issues/20592
|
||||
# TODO: remove once bootstrap ghc is 9.2.3 or later.
|
||||
ENV.append_path "C_INCLUDE_PATH", "#{MacOS.sdk_path_if_needed}/usr/include/ffi" if OS.mac? && Hardware::CPU.arm?
|
||||
ENV["PYTHON"] = which("python3.11")
|
||||
# Work around `ENV["CC"]` no longer being used unless set to absolute path.
|
||||
# Caused by https://gitlab.haskell.org/ghc/ghc/-/commit/6be2c5a7e9187fc14d51e1ec32ca235143bb0d8b
|
||||
# Issue ref: https://gitlab.haskell.org/ghc/ghc/-/issues/22175
|
||||
# TODO: remove once upstream issue is fixed
|
||||
ENV["ac_cv_path_CC"] = ENV.cc
|
||||
|
||||
resource("binary").stage do
|
||||
binary = buildpath/"binary"
|
||||
|
||||
resource("binary").stage do
|
||||
binary_args = []
|
||||
if OS.linux?
|
||||
binary_args << "--with-gmp-includes=#{Formula["gmp"].opt_include}"
|
||||
|
@ -89,13 +106,37 @@ class Ghc < Formula
|
|||
ENV.prepend_path "PATH", binary/"bin"
|
||||
end
|
||||
|
||||
resource("cabal-install").stage { (binary/"bin").install "cabal" }
|
||||
system "cabal", "v2-update"
|
||||
if build.head?
|
||||
cabal_args = std_cabal_v2_args.reject { |s| s["installdir"] }
|
||||
system "cabal", "v2-install", "alex", "happy", *cabal_args, "--installdir=#{binary}/bin"
|
||||
system "./boot"
|
||||
end
|
||||
|
||||
system "./configure", "--prefix=#{prefix}", "--disable-numa", "--with-intree-gmp"
|
||||
system "make"
|
||||
ENV.deparallelize { system "make", "install" }
|
||||
hadrian_args = %W[
|
||||
-j#{ENV.make_jobs}
|
||||
--prefix=#{prefix}
|
||||
--flavour=release
|
||||
--docs=no-sphinx-pdfs
|
||||
]
|
||||
# Work around linkage error due to RPATH in ghc-iserv-dyn-ghc
|
||||
# Issue ref: https://gitlab.haskell.org/ghc/ghc/-/issues/22557
|
||||
unless build.head?
|
||||
os = OS.mac? ? "osx" : OS.kernel_name.downcase
|
||||
cpu = Hardware::CPU.arm? ? "aarch64" : Hardware::CPU.arch.to_s
|
||||
extra_rpath = rpath(source: lib/"ghc-#{version}/bin",
|
||||
target: lib/"ghc-#{version}/lib/#{cpu}-#{os}-ghc-#{version}")
|
||||
hadrian_args << "*.iserv.ghc.link.opts += -optl-Wl,-rpath,#{extra_rpath}"
|
||||
end
|
||||
# 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}/package.conf.d/package.cache").unlink
|
||||
(lib/"ghc-#{version}/package.conf.d/package.cache.lock").unlink
|
||||
ghc_libdir = build.head? ? lib.glob("ghc-*").first : lib/"ghc-#{version}"
|
||||
(ghc_libdir/"lib/package.conf.d/package.cache").unlink
|
||||
(ghc_libdir/"lib/package.conf.d/package.cache.lock").unlink
|
||||
|
||||
bin.env_script_all_files libexec, PATH: "${PATH}:#{Formula["llvm@12"].opt_bin}" if Hardware::CPU.arm?
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue