Skip to content

Instantly share code, notes, and snippets.

@ilovezfs
Created April 20, 2016 16:20
Show Gist options
  • Save ilovezfs/c4bc508827fc407957bd77e7f6e0d9a3 to your computer and use it in GitHub Desktop.
Save ilovezfs/c4bc508827fc407957bd77e7f6e0d9a3 to your computer and use it in GitHub Desktop.
ghc8
diff --git a/Formula/ghc.rb b/Formula/ghc.rb
index 98a2265..b6e0eec 100644
--- a/Formula/ghc.rb
+++ b/Formula/ghc.rb
@@ -1,8 +1,26 @@
class Ghc < Formula
desc "Glorious Glasgow Haskell Compilation System"
homepage "https://haskell.org/ghc/"
- url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3b-src.tar.bz2"
- sha256 "b0bb177b8095de6074e5a3538e55fd1fc187dae6eb6ae36b05582c55f7d2db6f"
+
+ stable do
+ url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3b-src.tar.bz2"
+ sha256 "b0bb177b8095de6074e5a3538e55fd1fc187dae6eb6ae36b05582c55f7d2db6f"
+
+ resource "binary" do
+ if MacOS.version <= :lion
+ url "https://downloads.haskell.org/~ghc/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2"
+ sha256 "f7a35bea69b6cae798c5f603471a53b43c4cc5feeeeb71733815db6e0a280945"
+ else
+ url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-x86_64-apple-darwin.tar.xz"
+ sha256 "852781d43d41cd55d02f818fe798bb4d1f7e52f488408167f413f7948cf1e7df"
+ end
+ end
+
+ resource "testsuite" do
+ url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-testsuite.tar.xz"
+ sha256 "50c151695c8099901334a8478713ee3bb895a90132e2b75d1493961eb8ec643a"
+ end
+ end
bottle do
sha256 "72c6c729ea385aaebfa22b55fe31b85f46e423a510c83d2f76c8f57336f9bf2c" => :el_capitan
@@ -10,7 +28,22 @@ class Ghc < Formula
sha256 "3ca8542ed077871a9da2e7af1a2362eb6ddc52501e6625fa5b06e9fda288e980" => :mavericks
end
- option "with-test", "Verify the build using the testsuite"
+ devel do
+ url "http://downloads.haskell.org/~ghc/8.0.1-rc3/ghc-8.0.0.20160411-src.tar.xz"
+ sha256 "b747ab0908355e08b43d4447c626abb02ef15aae2abed53a58487b5a2938d225"
+
+ resource "binary" do
+ url "http://downloads.haskell.org/~ghc/8.0.1-rc3/ghc-8.0.0.20160411-x86_64-apple-darwin.tar.xz"
+ sha256 "523983fe188265ab31c8b9b7ddc74cc81226ef08abf1820b23737534a0ebea22"
+ end
+
+ resource "testsuite" do
+ url "http://downloads.haskell.org/~ghc/8.0.1-rc3/ghc-8.0.0.20160411-testsuite.tar.xz"
+ sha256 "632be99d72107e73e660603cdbec84a2930c4a8ea4ac6d7fa88d3171c7b6745c"
+ end
+ end
+
+ option "without-test", "Verify the build using the testsuite"
deprecated_option "tests" => "with-test"
deprecated_option "with-tests" => "with-test"
@@ -32,26 +65,32 @@ class Ghc < Formula
end
end
- resource "binary" do
- if MacOS.version <= :lion
- url "https://downloads.haskell.org/~ghc/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2"
- sha256 "f7a35bea69b6cae798c5f603471a53b43c4cc5feeeeb71733815db6e0a280945"
- else
- url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-x86_64-apple-darwin.tar.xz"
- sha256 "852781d43d41cd55d02f818fe798bb4d1f7e52f488408167f413f7948cf1e7df"
- end
- end
+ def install
+ # As of Xcode 7.3 (and the corresponding CLT) `nm` is a symlink to `llvm-nm`
+ # and the old `nm` is renamed `nm-classic`. Building with the new `nm`, a
+ # segfault occurs with the following error:
+ # make[1]: * [compiler/stage2/dll-split.stamp] Segmentation fault: 11
+ # Upstream is aware of the issue and is recommending the use of nm-classic
+ # until Apple and LLVM restore POSIX compliance:
+ # https://ghc.haskell.org/trac/ghc/ticket/11744
+ # https://ghc.haskell.org/trac/ghc/ticket/11823
+ # https://mail.haskell.org/pipermail/ghc-devs/2016-April/011862.html
+ if MacOS.clang_build_version >= 703
+ nm_classic = buildpath/"brewtools/nm"
+
+ nm_classic.write <<-EOS.undent
+ #!/bin/bash
+ exec xcrun nm-classic "$@"
+ EOS
- resource "testsuite" do
- url "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-testsuite.tar.xz"
- sha256 "50c151695c8099901334a8478713ee3bb895a90132e2b75d1493961eb8ec643a"
- end
+ chmod 0755, nm_classic
+ ENV.prepend_path "PATH", buildpath/"brewtools"
+ end
- def install
# Build a static gmp rather than in-tree gmp, otherwise it links to brew's.
gmp = libexec/"integer-gmp"
- # MPN_PATH: The lowest common denomenator asm paths that work on Darwin,
+ # MPN_PATH: The lowest common denominator asm paths that work on Darwin,
# corresponding to Yonah and Merom. Obviates --disable-assembly.
ENV["MPN_PATH"] = "x86_64/fastsse x86_64/core2 x86_64 generic" if build.bottle?
@@ -85,6 +124,9 @@ class Ghc < Formula
end
system "./configure", "--prefix=#{prefix}", *args
+ inreplace "libffi/ghc.mk",
+ "$(MAKE) -C libffi/build MAKEFLAGS=",
+ "sync; $(MAKE) -C libffi/build MAKEFLAGS="
system "make"
if build.with? "test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment