aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/llvm.rb
diff options
context:
space:
mode:
authorRonaldo M. Ferraz2011-01-09 16:32:58 -0200
committerMike McQuaid2011-01-09 19:06:10 +0000
commitc052e0b4d88c7961320dbae4a538e029c4f60d04 (patch)
tree8e1fe8f07b0a3ddc497b329be06338cbf4b4160e /Library/Formula/llvm.rb
parentfc3098957ebf154ef2dbae633f9a4cec2705ad42 (diff)
downloadhomebrew-c052e0b4d88c7961320dbae4a538e029c4f60d04.tar.bz2
Add shared and rtti options to LLVM.
* Added a --shared option to build LLVM as a shared library. (Shouldn't be used with --universal as it will cause the build to fail) * Added a --rtti option to build LLVM with RTTI information. (Can be used, for example, to build LLVM for use with Rubinius) Closes #3847. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula/llvm.rb')
-rw-r--r--Library/Formula/llvm.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/Library/Formula/llvm.rb b/Library/Formula/llvm.rb
index 2c6718e0b..eb0df61f1 100644
--- a/Library/Formula/llvm.rb
+++ b/Library/Formula/llvm.rb
@@ -2,6 +2,8 @@ require 'formula'
def build_clang?; ARGV.include? '--with-clang'; end
def build_universal?; ARGV.include? '--universal'; end
+def build_shared?; ARGV.include? '--shared'; end
+def build_rtti?; ARGV.include? '--rtti'; end
class Clang <Formula
url 'http://llvm.org/releases/2.8/clang-2.8.tgz'
@@ -16,12 +18,19 @@ class Llvm <Formula
def options
[['--with-clang', 'Also build & install clang'],
+ ['--shared', 'Build shared library'],
+ ['--rtti', 'Build with RTTI information'],
['--universal', 'Build both i386 and x86_64 architectures']]
end
def install
ENV.gcc_4_2 # llvm can't compile itself
+ if build_shared? && build_universal?
+ onoe "Cannot specify both shared and universal (will not build)"
+ exit 1
+ end
+
if build_clang?
clang_dir = Pathname.new(Dir.pwd)+'tools/clang'
Clang.new.brew { clang_dir.install Dir['*'] }
@@ -32,10 +41,17 @@ class Llvm <Formula
ENV['UNIVERSAL_ARCH'] = 'i386 x86_64'
end
- system "./configure", "--prefix=#{prefix}",
- "--enable-targets=host-only",
- "--enable-optimized"
- system "make" # seperate steps required, otherwise the build fails
+ ENV['REQUIRES_RTTI'] = '1' if build_rtti?
+
+ configure_options = ["--prefix=#{prefix}",
+ "--enable-targets=host-only",
+ "--enable-optimized"]
+
+ configure_options << "--enable-shared" if build_shared?
+
+ system "./configure", *configure_options
+
+ system "make" # separate steps required, otherwise the build fails
system "make install"
if build_clang?