From f93da5f415637bb24981d87a4bcd29cf751d2a22 Mon Sep 17 00:00:00 2001 From: Robert Lenhardt Date: Sat, 11 Aug 2012 10:21:42 +0100 Subject: llvm: update to 3.1 and cleanup options - remove --jit, enabled by default - call only make install - directory with python bindings is copied to share folder - remove --analyzer option, scan-build and scan-view are copied to share/clang/tools folder instead of installing in bin - remove old patch to Makefile Closes #13895. Signed-off-by: Mike McQuaid --- Library/Formula/llvm.rb | 94 ++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 68 deletions(-) (limited to 'Library') diff --git a/Library/Formula/llvm.rb b/Library/Formula/llvm.rb index e7c838b5f..df29911d7 100644 --- a/Library/Formula/llvm.rb +++ b/Library/Formula/llvm.rb @@ -1,48 +1,36 @@ require 'formula' def build_clang?; ARGV.include? '--with-clang'; end -def build_all_targets?; ARGV.include? '--all-targets'; end -def build_analyzer?; ARGV.include? '--analyzer'; end def build_universal?; ARGV.build_universal?; end def build_shared?; ARGV.include? '--shared'; end -def build_rtti?; ARGV.include? '--rtti'; end -def build_jit?; ARGV.include? '--jit'; end class Clang < Formula homepage 'http://llvm.org/' - url 'http://llvm.org/releases/3.0/clang-3.0.tar.gz' - md5 '43350706ae6cf05d0068885792ea0591' + url 'http://llvm.org/releases/3.1/clang-3.1.src.tar.gz' + sha1 '19f33b187a50d22fda2a6f9ed989699a9a9efd62' head 'http://llvm.org/git/clang.git' end class Llvm < Formula homepage 'http://llvm.org/' - url 'http://llvm.org/releases/3.0/llvm-3.0.tar.gz' - md5 'a8e5f5f1c1adebae7b4a654c376a6005' + url 'http://llvm.org/releases/3.1/llvm-3.1.src.tar.gz' + sha1 '234c96e73ef81aec9a54da92fc2a9024d653b059' head 'http://llvm.org/git/llvm.git' bottle do - sha1 'f6feaab7d1e4f45cd5f0b63d465e65f491fcc27c' => :lion - sha1 '0b4a9baac5cd07192f992ef3621371e9cde3979a' => :snowleopard - end - - def patches - # changes the link options for the shared library build - # to use the preferred way to build libraries in Mac OS X - # Reported upstream: http://llvm.org/bugs/show_bug.cgi?id=8985 - DATA if build_shared? + sha1 'fcf6c3eb5b074afa820f905f32182e074a29ffb5' => :mountainlion + sha1 '4ee3e9242cff9a03af4e1f20017fe547dcd07a4a' => :lion + sha1 '940aca37dafaf69a9b378ffd2a59b3c1cfe54ced' => :snowleopard end def options - [['--with-clang', 'Build clang'], - ['--analyzer', 'Build clang analyzer'], - ['--shared', 'Build shared library'], + [['--with-clang', 'Build clang C/ObjC/C++ frontend'], + ['--shared', 'Build llvm as shared library, and link tools against it'], ['--all-targets', 'Build all target backends'], - ['--rtti', 'Build with RTTI information'], - ['--universal', 'Build both i386 and x86_64 architectures'], - ['--jit', 'Build with Just In Time (JIT) compiler functionality']] + ['--rtti', 'Build llvm with C++ RTTI, use if you need RTTI of llvm classes'], + ['--universal', 'Build both i386 and x86_64 architectures']] end def install @@ -51,57 +39,41 @@ class Llvm < Formula exit 1 end - Clang.new("clang").brew { clang_dir.install Dir['*'] } if build_clang? or build_analyzer? + Clang.new("clang").brew { clang_dir.install Dir['*'] } if build_clang? if build_universal? ENV['UNIVERSAL'] = '1' ENV['UNIVERSAL_ARCH'] = 'i386 x86_64' end - ENV['REQUIRES_RTTI'] = '1' if build_rtti? + ENV['REQUIRES_RTTI'] = '1' if ARGV.include? '--rtti' configure_options = [ "--prefix=#{prefix}", "--enable-optimized", - # As of LLVM 3.0, the only bindings offered are for OCaml and attempting - # to build these when Homebrew's OCaml is installed results in errors. - # - # See issue #8947 for details. - "--enable-bindings=none" + # As of LLVM 3.1, attempting to build ocaml bindings with Homebrew's + # OCaml 3.12.1 results in errors. + "--disable-bindings", ] - if build_all_targets? + if ARGV.include? '--all-targets'? configure_options << "--enable-targets=all" else - configure_options << "--enable-targets=host-only" + configure_options << "--enable-targets=host" end - configure_options << "--enable-shared" if build_shared? - configure_options << "--enable-jit" if build_jit? system "./configure", *configure_options - - system "make" # separate steps required, otherwise the build fails system "make install" - cd clang_dir do - system "make install" - bin.install 'tools/scan-build/set-xcode-analyzer' - end if build_clang? or build_analyzer? + # install llvm python bindings + (share/'llvm/bindings').install buildpath/'bindings/python' + # install clang tools and bindings cd clang_dir do - bin.install 'tools/scan-build/scan-build' - bin.install 'tools/scan-build/ccc-analyzer' - bin.install 'tools/scan-build/c++-analyzer' - bin.install 'tools/scan-build/sorttable.js' - bin.install 'tools/scan-build/scanview.css' - - bin.install 'tools/scan-view/scan-view' - bin.install 'tools/scan-view/ScanView.py' - bin.install 'tools/scan-view/Reporter.py' - bin.install 'tools/scan-view/startfile.py' - bin.install 'tools/scan-view/Resources' - end if build_analyzer? + (share/'clang/tools').install 'tools/scan-build', 'tools/scan-view' + (share/'clang/bindings').install 'bindings/python' + end if build_clang? end def test @@ -109,6 +81,8 @@ class Llvm < Formula end def caveats; <<-EOS.undent + Extra tools and bindings are installed in #{share}/llvm and #{share}/clang. + If you already have LLVM installed, then "brew upgrade llvm" might not work. Instead, try: brew rm llvm && brew install llvm @@ -119,19 +93,3 @@ class Llvm < Formula buildpath/'tools/clang' end end - - -__END__ -diff --git i/Makefile.rules w/Makefile.rules -index 5fc77a5..a6baaf4 100644 ---- i/Makefile.rules -+++ w/Makefile.rules -@@ -507,7 +507,7 @@ ifeq ($(HOST_OS),Darwin) - # Get "4" out of 10.4 for later pieces in the makefile. - DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/') - -- LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress -+ LoadableModuleOptions := -Wl,-undefined,dynamic_lookup - SharedLinkOptions := -dynamiclib - ifneq ($(ARCH),ARM) - SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION) -- cgit v1.2.3