homebrew-core/Formula/ghc.rb

190 lines
5.9 KiB
Ruby
Raw Normal View History

require 'formula'
class Ghc < Formula
homepage 'http://haskell.org/ghc/'
url 'http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-src.tar.bz2'
sha1 '8938e1ef08b37a4caa071fa169e79a3001d065ff'
2013-09-20 20:51:19 +00:00
bottle do
2013-10-28 12:37:58 +00:00
revision 2
sha1 'a6ceeb3f1f9ba2cf0454dc9d45dce69f8a5ae736' => :mavericks
sha1 'd91ee56c8066bae5173f705e83e15dbb8842f67f' => :mountain_lion
sha1 '1569f19cdad2675cbff328c0e259d6b8573e9d11' => :lion
2013-09-20 20:51:19 +00:00
end
option '32-bit'
option 'tests', 'Verify the build using the testsuite.'
2012-09-14 16:07:47 +00:00
devel do
# This block should largely translate over for 7.8.1 when GM.
url 'http://www.haskell.org/ghc/dist/7.8.1-rc2/ghc-7.8.0.20140228-src.tar.bz2'
sha1 '8bd8eb3410a7fccc322c0e23e8045fcb5793ea5a'
2012-04-17 13:50:31 +00:00
# Upstream documentation says lion, but brew test-bot 10.7 fails.
depends_on :macos => :mountain_lion
2013-09-24 23:42:45 +00:00
resource 'binary' do
url 'http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2'
sha1 'fb9f18197852181a9472221e1944081985b75992'
end
resource 'binary-32' do
url 'http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-i386-apple-darwin.tar.bz2'
sha1 'fb9f18197852181a9472221e1944081985b75992'
end
resource 'testsuite' do
url 'http://www.haskell.org/ghc/dist/7.8.1-rc2/ghc-7.8.0.20140228-testsuite.tar.bz2'
sha1 '0c52e15c699b1c624fbc218b98ddfb44bc43cec8'
2013-09-22 05:20:28 +00:00
end
end
stable do
env :std
2012-10-06 19:48:27 +00:00
# http://hackage.haskell.org/trac/ghc/ticket/6009
depends_on :macos => :snow_leopard
depends_on 'apple-gcc42' if MacOS.version >= :mountain_lion
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 'binary-32' do
url 'http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-i386-apple-darwin.tar.bz2'
sha1 '60f749893332d7c22bb4905004a67510992d8ef6'
end
resource 'testsuite' do
url 'https://github.com/ghc/testsuite/archive/ghc-7.6.3-release.tar.gz'
sha1 '6a1973ae3cccdb2f720606032ae84ffee8680ca1'
end
def patches
# Fixes 7.6.3 compilation on 10.9
DATA if MacOS.version >= :mavericks
end
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
def install
# Move the main tarball contents into a subdirectory
(buildpath+'Ghcsource').install Dir['*']
binary = build.build_32_bit? ? 'binary-32' : 'binary'
resource(binary).stage do
# Define where the subformula will temporarily install itself
subprefix = buildpath+'subfo'
# ensure configure does not use Xcode 5 "gcc" which is actually clang
args = ["--prefix=#{subprefix}"]
args << "--with-gcc=#{ENV.cc}"
system "./configure", *args
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
system 'make -j1 install' # -j1 fixes an intermittent race condition
ENV.prepend 'PATH', subprefix/'bin', ':'
end
cd 'Ghcsource' do
# Fix an assertion when linking ghc with llvm-gcc
# https://github.com/Homebrew/homebrew/issues/13650
ENV['LD'] = 'ld'
if Hardware.is_64_bit? and not build.build_32_bit?
arch = 'x86_64'
else
ENV.m32 # Need to force this to fix build error on internal libgmp_ar.
arch = 'i386'
end
# ensure configure does not use Xcode 5 "gcc" which is actually clang
args = ["--prefix=#{prefix}", "--build=#{arch}-apple-darwin"]
args << "--with-gcc=#{ENV.cc}"
system "./configure", *args
system 'make'
if build.include? 'tests'
2013-09-20 20:51:19 +00:00
resource('testsuite').stage 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/*']
cd (buildpath+'Ghcsource/tests') do
system 'make', 'CLEANUP=1', "THREADS=#{ENV.make_jobs}", 'fast'
end
end
end
system 'make'
system 'make -j1 install' # -j1 fixes an intermittent race condition
end
end
2010-06-29 04:42:12 +00:00
def caveats; <<-EOS.undent
This brew is for GHC only; you might also be interested in haskell-platform.
EOS
end
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
end
__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+"./$@"}