2010-02-23 19:45:44 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-04-17 13:50:31 +00:00
|
|
|
class NeedsSnowLeopard < Requirement
|
|
|
|
def satisfied?
|
2012-09-05 04:04:01 +00:00
|
|
|
MacOS.version >= :snow_leopard
|
2012-04-17 13:50:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def message; <<-EOS.undent
|
|
|
|
GHC requires OS X 10.6 or newer. The binary releases no longer work on
|
|
|
|
Leopard. See the following issue for details:
|
|
|
|
http://hackage.haskell.org/trac/ghc/ticket/6009
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-25 23:04:20 +00:00
|
|
|
class Ghcbinary < Formula
|
2012-08-13 00:01:40 +00:00
|
|
|
if Hardware.is_64_bit? and not build.build_32_bit?
|
2012-06-11 12:32:55 +00:00
|
|
|
url 'http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-apple-darwin.tar.bz2'
|
|
|
|
sha1 '7c655701672f4b223980c3a1068a59b9fbd08825'
|
2011-03-28 09:37:52 +00:00
|
|
|
else
|
2012-06-11 12:32:55 +00:00
|
|
|
url 'http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-i386-apple-darwin.tar.bz2'
|
|
|
|
sha1 '60f749893332d7c22bb4905004a67510992d8ef6'
|
2011-03-28 09:37:52 +00:00
|
|
|
end
|
2012-08-25 23:04:20 +00:00
|
|
|
version '7.4.2'
|
|
|
|
end
|
|
|
|
|
|
|
|
class Ghctestsuite < Formula
|
|
|
|
url 'https://github.com/ghc/testsuite/tarball/ghc-7.4.2-release'
|
|
|
|
sha1 '6b1f161a78a70638aacc931abfdef7dd50c7f923'
|
|
|
|
end
|
|
|
|
|
|
|
|
class Ghc < Formula
|
|
|
|
homepage 'http://haskell.org/ghc/'
|
|
|
|
url 'http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-src.tar.bz2'
|
|
|
|
sha1 '73b3b39dc164069bc80b69f7f2963ca1814ddf3d'
|
2010-02-23 19:45:44 +00:00
|
|
|
|
2012-09-14 16:07:47 +00:00
|
|
|
env :std
|
|
|
|
|
2012-04-17 13:50:31 +00:00
|
|
|
depends_on NeedsSnowLeopard.new
|
|
|
|
|
2012-08-13 00:01:40 +00:00
|
|
|
option '32-bit'
|
2012-08-25 23:04:20 +00:00
|
|
|
option 'tests', 'Verify the build using the testsuite in Fast Mode, 5 min'
|
2012-08-13 00:01:40 +00:00
|
|
|
|
2012-10-06 19:48:27 +00:00
|
|
|
bottle do
|
|
|
|
sha1 '72c7e8ad7d25382261ed431f953920004439ad69' => :mountainlion
|
|
|
|
sha1 '16c188ebe10aa06250af12268be39d56284aec91' => :lion
|
|
|
|
sha1 '68c1fcff903826dde6fc8e2a120ae8a69a8bafb2' => :snowleopard
|
|
|
|
end
|
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
fails_with :clang do
|
2012-08-06 17:16:02 +00:00
|
|
|
build 421
|
2012-03-18 20:33:24 +00:00
|
|
|
cause <<-EOS.undent
|
|
|
|
Building with Clang configures GHC to use Clang as its preprocessor,
|
|
|
|
which causes subsequent GHC-based builds to fail.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2012-08-25 23:04:20 +00:00
|
|
|
def patches
|
|
|
|
# Explained: http://hackage.haskell.org/trac/ghc/ticket/7040
|
|
|
|
# Discussed: https://github.com/mxcl/homebrew/issues/13519
|
|
|
|
# Remove: version > 7.4.2
|
|
|
|
'http://hackage.haskell.org/trac/ghc/raw-attachment/ticket/7040/ghc7040.patch'
|
|
|
|
end
|
|
|
|
|
2010-02-23 19:45:44 +00:00
|
|
|
def install
|
2012-08-25 23:04:20 +00:00
|
|
|
# Move the main tarball contents into a subdirectory
|
|
|
|
(buildpath+'Ghcsource').install Dir['*']
|
|
|
|
|
|
|
|
# Define where the subformula will temporarily install itself
|
|
|
|
subprefix = buildpath+'subfo'
|
|
|
|
|
|
|
|
Ghcbinary.new.brew do
|
|
|
|
system "./configure", "--prefix=#{subprefix}"
|
|
|
|
# Temporary j1 to stop an intermittent race condition
|
|
|
|
system 'make', '-j1', 'install'
|
|
|
|
ENV.prepend 'PATH', subprefix/'bin', ':'
|
|
|
|
end
|
|
|
|
|
|
|
|
cd 'Ghcsource' do
|
|
|
|
# Fix an assertion when linking ghc with llvm-gcc
|
|
|
|
# https://github.com/mxcl/homebrew/issues/13650
|
|
|
|
ENV['LD'] = 'ld'
|
|
|
|
|
|
|
|
if Hardware.is_64_bit? and not build.build_32_bit?
|
|
|
|
arch = 'x86_64'
|
|
|
|
else
|
2012-11-09 08:03:33 +00:00
|
|
|
ENV.m32 # Need to force this to fix build error on internal libgmp.
|
2012-08-25 23:04:20 +00:00
|
|
|
arch = 'i386'
|
|
|
|
end
|
|
|
|
|
|
|
|
system "./configure", "--prefix=#{prefix}",
|
|
|
|
"--build=#{arch}-apple-darwin"
|
|
|
|
system 'make'
|
|
|
|
if build.include? 'tests'
|
|
|
|
Ghctestsuite.new.brew 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
|
|
|
|
ENV.j1 # Fixes an intermittent race condition
|
|
|
|
system 'make', 'install'
|
|
|
|
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
|
|
|
|
This brew is for GHC only; you might also be interested in haskell-platform.
|
|
|
|
EOS
|
2010-02-23 19:45:44 +00:00
|
|
|
end
|
|
|
|
end
|