Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix ghc --devel build on Lion and Mavericks #26537

Closed
wants to merge 1 commit into from

3 participants

@dholm

No description provided.

@asparagui
Owner

See also #26459.

@dholm

@mikemcquaid I have pushed a version which should resolve this issue (although I cannot verify this myself).

Library/Formula/ghc.rb
@@ -85,6 +110,8 @@ def install
args << "--with-gcc=#{ENV.cc}"
system "./configure", *args
+ # __thread is not supported on Lion but configure enables it anyway.
+ system "echo '#undef CC_SUPPORTS_TLS' >> config.h" if build.devel? && MacOS.version <= :lion
@mikemcquaid Owner

Use Pathname.write instead.

@dholm
dholm added a note

Pathname.write will append by default? I googled it and couldn't find a conclusive answer.

@mikemcquaid Owner

My bad. I just just use a Ruby method to write to this instead of echo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mikemcquaid
Owner

Still failing. Just check the test results yourself periodically and keep pushing changes until it works, thanks.

@dholm

@mikemcquaid

Applying: ghc --devel 7.8-rc1
error: patch failed: Library/Formula/ghc.rb:12
error: Library/Formula/ghc.rb: patch does not apply
Patch failed at 0001 ghc --devel 7.8-rc1
The copy of the patch that failed is found in:
   /usr/local/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: Patch failed to apply: aborted.

Hmm?

@mikemcquaid
Owner

That means it needs rebased.

@dholm

The merged version of 7.8-rc1 has some inconsistencies. For instance, it doesn't require apple-gcc42 when built with --devel even though the install step clearly states that it requires it (and also I was unable to build it using Clang).
It builds the --devel version using the binary version of 7.8-rc1 but IMHO it makes more sense to use the stable version (7.6.3) like is done for ghc stable (which is built using ghc 7.4.2 binaries). I pushed a new version to see if the fix will work on Lion, if it does I will have to change the commit message. :)

@dholm dholm closed this
@dholm dholm deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 12, 2014
  1. @dholm
This page is out of date. Refresh to see the latest.
Showing with 46 additions and 38 deletions.
  1. +46 −38 Library/Formula/ghc.rb
View
84 Library/Formula/ghc.rb
@@ -12,39 +12,18 @@ class Ghc < Formula
sha1 '1569f19cdad2675cbff328c0e259d6b8573e9d11' => :lion
end
- option 'tests', 'Verify the build using the testsuite.'
-
- devel do
- # http://www.haskell.org/ghc/dist/7.8.1-rc1/README.osx.html
- # This block should largely translate over for 7.8.1 when GM.
- url 'http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-src.tar.bz2'
- sha1 'b9c4d76ff71225fe58bdc4e53d7c659643463b5a'
-
- # Upstream documentation says lion, but brew test-bot 10.7 fails.
- depends_on :macos => :mountain_lion
-
- resource 'binary' do
- url 'http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-x86_64-apple-darwin-lion.tar.bz2'
- sha1 '9026d889b160fbf56f97ec1e91576a20e5eec725'
- end
-
- resource 'testsuite' do
- url 'http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-testsuite.tar.bz2'
- sha1 '17b1d486c1111633bcfa940b9bf940194cf09bc9'
- end
- end
-
- unless build.devel?
- env :std
+ env :std
- # http://hackage.haskell.org/trac/ghc/ticket/6009
- depends_on :macos => :snow_leopard
- depends_on 'apple-gcc42' if MacOS.version >= :mountain_lion
+ # http://hackage.haskell.org/trac/ghc/ticket/6009
+ depends_on :macos => :snow_leopard
+ depends_on 'apple-gcc42' if MacOS.version >= :mountain_lion
- option '32-bit'
+ option '32-bit'
+ option 'tests', 'Verify the build using the testsuite.'
- # build is not available in the resource's context, so exploit the closure.
- build_32_bit = build.build_32_bit?
+ # build is not available in the resource's context, so exploit the closure.
+ build_32_bit = build.build_32_bit?
+ stable do
resource 'binary' do
if Hardware.is_64_bit? and not build_32_bit
url 'http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-apple-darwin.tar.bz2'
@@ -59,20 +38,43 @@ class Ghc < Formula
url 'https://github.com/ghc/testsuite/archive/ghc-7.6.3-release.tar.gz'
sha1 '6a1973ae3cccdb2f720606032ae84ffee8680ca1'
end
+ 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
+ devel do
+ # http://www.haskell.org/ghc/dist/7.8.1-rc1/README.osx.html
+ # This block should largely translate over for 7.8.1 when GM.
+ url 'http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-src.tar.bz2'
+ sha1 'b9c4d76ff71225fe58bdc4e53d7c659643463b5a'
+ version '7.8-rc1'
+
+ resource 'binary' do
+ if Hardware.is_64_bit? and not build_32_bit
+ url 'http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2'
+ sha1 'fb9f18197852181a9472221e1944081985b75992'
+ else
+ url 'http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-i386-apple-darwin.tar.bz2'
+ sha1 'fb9f18197852181a9472221e1944081985b75992'
+ end
end
- def patches
- # Fixes 7.6.3 compilation on 10.9
- DATA if MacOS.version >= :mavericks
+ resource 'testsuite' do
+ url 'http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-testsuite.tar.bz2'
+ sha1 '17b1d486c1111633bcfa940b9bf940194cf09bc9'
end
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
+
+ def patches
+ # Fixes 7.6.3 compilation on 10.9
+ DATA if build.stable? && MacOS.version >= :mavericks
+ end
+
def install
# Move the main tarball contents into a subdirectory
(buildpath+'Ghcsource').install Dir['*']
@@ -107,6 +109,12 @@ def install
args << "--with-gcc=#{ENV.cc}"
system "./configure", *args
+ if MacOS.version <= :lion
+ # __thread is not supported on Lion but configure enables it anyway.
+ File.open('mk/config.h', 'a') do |f|
+ f.write('#undef CC_SUPPORTS_TLS')
+ end
+ end
system 'make'
if build.include? 'tests'
resource('testsuite').stage do
Something went wrong with that request. Please try again.