2012-08-25 23:04:20 +00:00
|
|
|
class Ghc < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Glorious Glasgow Haskell Compilation System"
|
2015-03-28 00:32:51 +00:00
|
|
|
homepage "https://haskell.org/ghc/"
|
2015-03-18 02:38:35 +00:00
|
|
|
url "https://downloads.haskell.org/~ghc/7.10.1/ghc-7.10.1-src.tar.xz"
|
|
|
|
sha256 "92f3e3d67a637c587c49b61c704a670953509eb4b17a93c0c2ac153da4cd3aa0"
|
2010-02-23 19:45:44 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
revision 1
|
|
|
|
|
2013-09-20 20:51:19 +00:00
|
|
|
bottle do
|
2015-05-13 09:28:16 +00:00
|
|
|
sha256 "969cc9bfd6574070982d1bd6678f1eeee430940d00d10b70204528cc9ce84c07" => :yosemite
|
|
|
|
sha256 "bb82b24644330273d5e8b02b5c3ced76cbde1b388a45047327db3cfd5f07fe1f" => :mavericks
|
|
|
|
sha256 "8b7900d0f6a72312969494b70ace58ed03ef8624b52d5db63ecccc00cf056e98" => :mountain_lion
|
2013-09-20 20:51:19 +00:00
|
|
|
end
|
|
|
|
|
2015-01-31 19:52:27 +00:00
|
|
|
option "with-tests", "Verify the build using the testsuite."
|
|
|
|
deprecated_option "tests" => "with-tests"
|
2012-09-14 16:07:47 +00:00
|
|
|
|
2015-04-01 13:55:35 +00:00
|
|
|
resource "gmp" do
|
|
|
|
url "http://ftpmirror.gnu.org/gmp/gmp-6.0.0a.tar.bz2"
|
2015-05-13 15:54:36 +00:00
|
|
|
mirror "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2"
|
|
|
|
mirror "https://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.bz2"
|
2015-04-01 13:55:35 +00:00
|
|
|
sha256 "7f8e9a804b9c6d07164cf754207be838ece1219425d64e28cfa3e70d5c759aaf"
|
|
|
|
end
|
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
if MacOS.version <= :lion
|
|
|
|
fails_with :clang do
|
|
|
|
cause <<-EOS.undent
|
|
|
|
Fails to bootstrap ghc-cabal. Error is:
|
|
|
|
libraries/Cabal/Cabal/Distribution/Compat/Binary/Class.hs:398:14:
|
|
|
|
The last statement in a 'do' block must be an expression
|
|
|
|
n <- get :: Get Int getMany n
|
|
|
|
EOS
|
2014-03-05 19:13:08 +00:00
|
|
|
end
|
2014-05-09 12:52:29 +00:00
|
|
|
end
|
2014-03-05 19:13:08 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
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.1/ghc-7.10.1-x86_64-apple-darwin.tar.xz"
|
|
|
|
sha256 "bc45de19efc831f7d5a3fe608ba4ebcd24cc0f414cac4bc40ef88a04640583f6"
|
2015-01-31 19:52:27 +00:00
|
|
|
end
|
2014-09-08 20:25:39 +00:00
|
|
|
end
|
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
resource "testsuite" do
|
|
|
|
url "https://downloads.haskell.org/~ghc/7.10.1/ghc-7.10.1-testsuite.tar.xz"
|
|
|
|
sha256 "33bbdfcfa50363526ea9671c8c1f01b7c5dec01372604d45cbb53bb2515298cb"
|
2014-03-08 18:13:03 +00:00
|
|
|
end
|
|
|
|
|
2013-08-24 07:48:30 +00:00
|
|
|
def install
|
2015-04-29 04:02:55 +00:00
|
|
|
# Build a static gmp rather than in-tree gmp, otherwise it links to brew's.
|
|
|
|
gmp = libexec/"integer-gmp"
|
2015-04-01 13:55:35 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
# MPN_PATH: The lowest common denomenator 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?
|
2015-04-01 13:55:35 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
# GMP *does not* use PIC by default without shared libs so --with-pic
|
|
|
|
# is mandatory or else you'll get "illegal text relocs" errors.
|
|
|
|
resource("gmp").stage do
|
|
|
|
system "./configure", "--prefix=#{gmp}", "--with-pic", "--disable-shared"
|
2015-04-01 13:55:35 +00:00
|
|
|
system "make"
|
|
|
|
system "make", "check"
|
2015-04-29 04:02:55 +00:00
|
|
|
ENV.deparallelize { system "make", "install" }
|
2015-04-01 13:55:35 +00:00
|
|
|
end
|
2015-03-08 10:16:59 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
args = ["--with-gmp-includes=#{gmp}/include",
|
|
|
|
"--with-gmp-libraries=#{gmp}/lib",
|
|
|
|
"--with-ld=ld", # Avoid hardcoding superenv's ld.
|
|
|
|
# The offending -Wno-[unicode] flags get appended here, so set:
|
|
|
|
"--with-hs-cpp-flags=-E -undef -traditional",
|
|
|
|
"--with-gcc=#{ENV.cc}"] # Always.
|
|
|
|
|
|
|
|
if ENV.compiler == :clang
|
|
|
|
args << "--with-clang=#{ENV.cc}"
|
|
|
|
elsif ENV.compiler == :llvm
|
|
|
|
args << "--with-gcc-4.2=#{ENV.cc}"
|
|
|
|
end
|
2012-08-25 23:04:20 +00:00
|
|
|
|
2014-09-08 20:25:39 +00:00
|
|
|
resource("binary").stage do
|
2015-04-29 04:02:55 +00:00
|
|
|
binary = buildpath/"binary"
|
2013-08-24 07:48:30 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
system "./configure", "--prefix=#{binary}", *args
|
|
|
|
ENV.deparallelize { system "make", "install" }
|
2014-03-05 19:13:08 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
ENV.prepend_path "PATH", binary/"bin"
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}", *args
|
|
|
|
system "make"
|
2012-08-25 23:04:20 +00:00
|
|
|
|
2015-04-29 04:02:55 +00:00
|
|
|
if build.with? "tests"
|
|
|
|
resource("testsuite").stage { buildpath.install Dir["*"] }
|
|
|
|
cd "testsuite" do
|
|
|
|
system "make", "clean"
|
|
|
|
system "make", "CLEANUP=1", "THREADS=#{ENV.make_jobs}", "fast"
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
|
|
|
end
|
2015-04-29 04:02:55 +00:00
|
|
|
|
|
|
|
ENV.deparallelize { system "make", "install" }
|
2011-03-28 09:37:52 +00:00
|
|
|
end
|
2010-06-29 04:42:12 +00:00
|
|
|
|
2014-03-06 04:39:25 +00:00
|
|
|
test do
|
2015-04-29 04:02:55 +00:00
|
|
|
(testpath/"hello.hs").write('main = putStrLn "Hello Homebrew"')
|
|
|
|
system "runghc", testpath/"hello.hs"
|
2014-03-06 04:39:25 +00:00
|
|
|
end
|
2010-02-23 19:45:44 +00:00
|
|
|
end
|