2010-02-23 19:45:44 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-08-25 23:04:20 +00:00
|
|
|
class Ghc < Formula
|
2014-03-08 15:22:27 +00:00
|
|
|
homepage "http://haskell.org/ghc/"
|
|
|
|
url "http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-src.tar.bz2"
|
|
|
|
sha1 "8938e1ef08b37a4caa071fa169e79a3001d065ff"
|
2014-07-23 06:34:40 +00:00
|
|
|
revision 3
|
2010-02-23 19:45:44 +00:00
|
|
|
|
2013-09-20 20:51:19 +00:00
|
|
|
bottle do
|
2014-07-24 10:14:43 +00:00
|
|
|
sha1 "75efb035488ce9f3119e621748370795d454f9c6" => :mavericks
|
|
|
|
sha1 "f288ec14e98973866babaf6aa63ceb612e39750c" => :mountain_lion
|
|
|
|
sha1 "73e1732a5e09557084bf25c5e1a6fbb17c5d3ee1" => :lion
|
2013-09-20 20:51:19 +00:00
|
|
|
end
|
|
|
|
|
2014-03-05 19:13:08 +00:00
|
|
|
option "32-bit"
|
2014-03-08 15:22:27 +00:00
|
|
|
option "tests", "Verify the build using the testsuite."
|
2012-09-14 16:07:47 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
# http://hackage.haskell.org/trac/ghc/ticket/6009
|
|
|
|
depends_on :macos => :snow_leopard
|
|
|
|
depends_on "gmp"
|
2012-04-17 13:50:31 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
devel do
|
|
|
|
url "https://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-src.tar.xz"
|
|
|
|
sha1 "fe86ae790b7e8e5b4c78db7a914ee375bc6d9fc3"
|
2013-09-24 23:42:45 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
resource "testsuite" do
|
|
|
|
url "https://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-testsuite.tar.xz"
|
|
|
|
sha1 "3abe4e0ebbed17e825573f0f34be0eca9179f9e4"
|
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
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
resource "binary_7.8" do
|
|
|
|
url "https://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-x86_64-apple-darwin-mavericks.tar.xz"
|
|
|
|
sha1 "5219737fb38f882532712047f6af32fc73a91f0f"
|
|
|
|
end
|
2012-08-13 00:01:40 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
resource "binary" do
|
|
|
|
url "http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-apple-darwin.tar.bz2"
|
|
|
|
sha1 "7c655701672f4b223980c3a1068a59b9fbd08825"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "binary32" do
|
|
|
|
url "http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-i386-apple-darwin.tar.bz2"
|
|
|
|
sha1 "60f749893332d7c22bb4905004a67510992d8ef6"
|
2013-09-22 05:20:28 +00:00
|
|
|
end
|
|
|
|
|
2014-03-08 18:13:03 +00:00
|
|
|
# These don't work inside of a `stable do` block
|
2014-05-09 12:52:29 +00:00
|
|
|
if build.stable? || build.build_32_bit? || !MacOS.prefer_64_bit? || MacOS.version < :mavericks
|
|
|
|
depends_on "gcc" if MacOS.version >= :mountain_lion
|
2014-02-09 13:59:54 +00:00
|
|
|
env :std
|
2012-10-06 19:48:27 +00:00
|
|
|
|
2014-03-08 18:13:03 +00:00
|
|
|
fails_with :clang do
|
|
|
|
cause <<-EOS.undent
|
|
|
|
Building with Clang configures GHC to use Clang as its preprocessor,
|
|
|
|
which causes subsequent GHC-based builds to fail.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
stable do
|
2014-03-08 15:22:27 +00:00
|
|
|
resource "testsuite" do
|
|
|
|
url "https://github.com/ghc/testsuite/archive/ghc-7.6.3-release.tar.gz"
|
|
|
|
sha1 "6a1973ae3cccdb2f720606032ae84ffee8680ca1"
|
2014-02-09 13:59:54 +00:00
|
|
|
end
|
2014-03-07 05:59:47 +00:00
|
|
|
|
2014-03-21 15:15:51 +00:00
|
|
|
# Fixes 7.6.3 compilation on 10.9
|
|
|
|
patch :DATA if MacOS.version >= :mavericks
|
2013-08-24 07:48:30 +00:00
|
|
|
end
|
2013-06-22 00:20:59 +00:00
|
|
|
|
2013-08-24 07:48:30 +00:00
|
|
|
def install
|
2012-08-25 23:04:20 +00:00
|
|
|
# Move the main tarball contents into a subdirectory
|
2014-03-08 15:22:27 +00:00
|
|
|
(buildpath+"Ghcsource").install Dir["*"]
|
2012-08-25 23:04:20 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
if build.build_32_bit? || !MacOS.prefer_64_bit?
|
2014-03-08 18:13:03 +00:00
|
|
|
binary_resource = "binary32"
|
2014-05-09 12:52:29 +00:00
|
|
|
elsif MacOS.version >= :mavericks && build.devel?
|
|
|
|
binary_resource = "binary_7.8"
|
|
|
|
else
|
|
|
|
binary_resource = "binary"
|
2014-03-08 18:13:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource(binary_resource).stage do
|
2013-08-24 07:48:30 +00:00
|
|
|
# Define where the subformula will temporarily install itself
|
2014-03-08 15:22:27 +00:00
|
|
|
subprefix = buildpath+"subfo"
|
2013-08-24 07:48:30 +00:00
|
|
|
|
|
|
|
# ensure configure does not use Xcode 5 "gcc" which is actually clang
|
|
|
|
args = ["--prefix=#{subprefix}"]
|
2013-09-19 03:18:40 +00:00
|
|
|
args << "--with-gcc=#{ENV.cc}"
|
2013-08-24 07:48:30 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2014-03-05 19:13:08 +00:00
|
|
|
if build.devel? and MacOS.version <= :lion
|
|
|
|
# __thread is not supported on Lion but configure enables it anyway.
|
|
|
|
File.open("mk/config.h", "a") do |file|
|
|
|
|
file.write("#undef CC_SUPPORTS_TLS")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-08 15:22:27 +00:00
|
|
|
# -j1 fixes an intermittent race condition
|
|
|
|
system "make", "-j1", "install"
|
|
|
|
ENV.prepend_path "PATH", subprefix/"bin"
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
|
|
|
|
2014-03-08 15:22:27 +00:00
|
|
|
cd "Ghcsource" do
|
2012-08-25 23:04:20 +00:00
|
|
|
# Fix an assertion when linking ghc with llvm-gcc
|
2013-12-14 18:13:11 +00:00
|
|
|
# https://github.com/Homebrew/homebrew/issues/13650
|
2014-03-08 15:22:27 +00:00
|
|
|
ENV["LD"] = "ld"
|
2012-08-25 23:04:20 +00:00
|
|
|
|
2014-05-09 12:52:29 +00:00
|
|
|
if build.build_32_bit? || !MacOS.prefer_64_bit?
|
2013-08-24 07:48:30 +00:00
|
|
|
ENV.m32 # Need to force this to fix build error on internal libgmp_ar.
|
2014-03-08 15:22:27 +00:00
|
|
|
arch = "i386"
|
2014-05-09 12:52:29 +00:00
|
|
|
else
|
|
|
|
arch = "x86_64"
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
|
|
|
|
2013-08-24 07:48:30 +00:00
|
|
|
# ensure configure does not use Xcode 5 "gcc" which is actually clang
|
|
|
|
args = ["--prefix=#{prefix}", "--build=#{arch}-apple-darwin"]
|
2013-09-19 03:18:40 +00:00
|
|
|
args << "--with-gcc=#{ENV.cc}"
|
2013-08-24 07:48:30 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2014-03-08 15:22:27 +00:00
|
|
|
system "make"
|
|
|
|
|
|
|
|
if build.include? "tests"
|
|
|
|
resource("testsuite").stage do
|
2014-04-11 18:25:21 +00:00
|
|
|
cd "testsuite" do
|
|
|
|
(buildpath+"Ghcsource/config").install Dir["config/*"]
|
|
|
|
(buildpath+"Ghcsource/driver").install Dir["driver/*"]
|
|
|
|
(buildpath+"Ghcsource/mk").install Dir["mk/*"]
|
|
|
|
(buildpath+"Ghcsource/tests").install Dir["tests/*"]
|
|
|
|
(buildpath+"Ghcsource/timeout").install Dir["timeout/*"]
|
|
|
|
end
|
2014-03-08 15:22:27 +00:00
|
|
|
cd (buildpath+"Ghcsource/tests") do
|
|
|
|
system "make", "CLEANUP=1", "THREADS=#{ENV.make_jobs}", "fast"
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-03-08 15:22:27 +00:00
|
|
|
|
|
|
|
system "make"
|
|
|
|
# -j1 fixes an intermittent race condition
|
|
|
|
system "make", "-j1", "install"
|
2014-05-09 12:52:29 +00:00
|
|
|
if build.devel?
|
|
|
|
# use clang, even when gcc was used to build ghc
|
|
|
|
settings = Dir[lib/"ghc-*/settings"][0]
|
|
|
|
inreplace settings, "\"#{ENV.cc}\"", "\"clang\""
|
|
|
|
end
|
2012-08-25 23:04:20 +00:00
|
|
|
end
|
2011-03-28 09:37:52 +00:00
|
|
|
end
|
2010-06-29 04:42:12 +00:00
|
|
|
|
2011-03-28 09:37:52 +00:00
|
|
|
def caveats; <<-EOS.undent
|
2014-05-09 12:52:29 +00:00
|
|
|
This brew is for GHC only; you might also be interested in cabal-install
|
|
|
|
or haskell-platform.
|
2011-03-28 09:37:52 +00:00
|
|
|
EOS
|
2010-02-23 19:45:44 +00:00
|
|
|
end
|
2014-03-06 04:39:25 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
hello = (testpath/"hello.hs")
|
|
|
|
hello.write('main = putStrLn "Hello Homebrew"')
|
|
|
|
output = `echo "main" | '#{bin}/ghci' #{hello}`
|
|
|
|
assert $?.success?
|
|
|
|
assert_match /Hello Homebrew/i, output
|
|
|
|
end
|
2010-02-23 19:45:44 +00:00
|
|
|
end
|
2013-08-24 07:48:30 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
diff --git a/includes/HsFFI.h b/includes/HsFFI.h
|
|
|
|
index 652fbea..a21811e 100644
|
|
|
|
--- a/includes/HsFFI.h
|
|
|
|
+++ b/includes/HsFFI.h
|
|
|
|
@@ -21,7 +21,7 @@ extern "C" {
|
|
|
|
#include "stg/Types.h"
|
|
|
|
|
|
|
|
/* get limits for integral types */
|
|
|
|
-#ifdef HAVE_STDINT_H
|
|
|
|
+#if defined HAVE_STDINT_H && !defined USE_INTTYPES_H_FOR_RTS_PROBES_D
|
|
|
|
/* ISO C 99 says:
|
|
|
|
* "C++ implementations should define these macros only when
|
|
|
|
* __STDC_LIMIT_MACROS is defined before <stdint.h> is included."
|
|
|
|
diff --git a/rts/RtsProbes.d b/rts/RtsProbes.d
|
|
|
|
index 13f40f8..226f881 100644
|
|
|
|
--- a/rts/RtsProbes.d
|
|
|
|
+++ b/rts/RtsProbes.d
|
|
|
|
@@ -6,6 +6,12 @@
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
+#ifdef __APPLE__ && __MACH__
|
|
|
|
+# if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
|
|
|
|
+# define USE_INTTYPES_H_FOR_RTS_PROBES_D
|
|
|
|
+# endif
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#include "HsFFI.h"
|
|
|
|
#include "rts/EventLogFormat.h"
|
|
|
|
|
|
|
|
diff --git a/utils/mkdirhier/mkdirhier.sh b/utils/mkdirhier/mkdirhier.sh
|
|
|
|
index 4c5d5f7..80762f4 100644
|
|
|
|
--- a/utils/mkdirhier/mkdirhier.sh
|
|
|
|
+++ b/utils/mkdirhier/mkdirhier.sh
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
-mkdir -p ${1+"$@"}
|
|
|
|
+mkdir -p ${1+"./$@"}
|