2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 13:45:04 +00:00
|
|
|
|
2010-06-05 17:27:11 +00:00
|
|
|
def build_clang?; ARGV.include? '--with-clang'; end
|
|
|
|
|
2009-11-18 22:08:29 +00:00
|
|
|
class Clang <Formula
|
2010-04-28 20:19:05 +00:00
|
|
|
url 'http://llvm.org/releases/2.7/clang-2.7.tgz'
|
2009-11-18 22:08:29 +00:00
|
|
|
homepage 'http://llvm.org/'
|
2010-04-28 20:19:05 +00:00
|
|
|
md5 'b83260aa8c13494adf8978b5f238bf1b'
|
2009-11-18 22:08:29 +00:00
|
|
|
end
|
|
|
|
|
2009-08-31 13:45:04 +00:00
|
|
|
class Llvm <Formula
|
2010-04-28 20:19:05 +00:00
|
|
|
url 'http://llvm.org/releases/2.7/llvm-2.7.tgz'
|
2009-11-18 22:08:29 +00:00
|
|
|
homepage 'http://llvm.org/'
|
2010-04-28 20:19:05 +00:00
|
|
|
md5 'ac322661f20e7d6c810b1869f886ad9b'
|
2009-11-18 22:08:29 +00:00
|
|
|
|
|
|
|
def options
|
2010-04-07 05:58:35 +00:00
|
|
|
[['--with-clang', 'Also build & install clang']]
|
2009-11-18 22:08:29 +00:00
|
|
|
end
|
|
|
|
|
2009-08-31 13:45:04 +00:00
|
|
|
def install
|
2009-11-04 17:10:52 +00:00
|
|
|
ENV.gcc_4_2 # llvm can't compile itself
|
|
|
|
|
2010-06-05 17:27:11 +00:00
|
|
|
if build_clang?
|
|
|
|
clang_dir = Pathname.new(Dir.pwd)+'tools/clang'
|
2010-04-07 05:58:35 +00:00
|
|
|
Clang.new.brew { clang_dir.install Dir['*'] }
|
2009-11-18 22:08:29 +00:00
|
|
|
end
|
|
|
|
|
2009-08-31 13:45:04 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}",
|
2009-11-16 12:45:52 +00:00
|
|
|
"--enable-targets=host-only",
|
2009-08-31 13:45:04 +00:00
|
|
|
"--enable-optimized"
|
2010-04-07 05:58:35 +00:00
|
|
|
system "make" # seperate steps required, otherwise the build fails
|
|
|
|
system "make install"
|
2009-11-18 22:08:29 +00:00
|
|
|
|
2010-06-05 17:27:11 +00:00
|
|
|
if build_clang?
|
2009-11-18 22:08:29 +00:00
|
|
|
Dir.chdir clang_dir do
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
end
|
2009-08-31 13:45:04 +00:00
|
|
|
end
|
|
|
|
end
|