2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 13:45:04 +00:00
|
|
|
|
2009-11-18 22:08:29 +00:00
|
|
|
class Clang <Formula
|
|
|
|
url 'http://llvm.org/releases/2.6/clang-2.6.tar.gz'
|
|
|
|
homepage 'http://llvm.org/'
|
|
|
|
md5 '09d696bf23bb4a3cf6af3c7341cdd946'
|
|
|
|
end
|
|
|
|
|
2009-08-31 13:45:04 +00:00
|
|
|
class Llvm <Formula
|
2009-11-18 22:08:29 +00:00
|
|
|
url 'http://llvm.org/releases/2.6/llvm-2.6.tar.gz'
|
|
|
|
homepage 'http://llvm.org/'
|
|
|
|
md5 '34a11e807add0f4555f691944e1a404a'
|
|
|
|
|
|
|
|
def options
|
|
|
|
[
|
|
|
|
['--with-clang', 'Also build & install clang']
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def clang?
|
|
|
|
ARGV.include? '--with-clang'
|
|
|
|
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
|
|
|
|
|
2009-11-18 22:08:29 +00:00
|
|
|
if clang?
|
|
|
|
clang_dir = File.join(Dir.pwd, 'tools', 'clang')
|
|
|
|
|
|
|
|
Clang.new.brew {
|
|
|
|
FileUtils.mkdir_p clang_dir
|
|
|
|
FileUtils.mv Dir['*'], clang_dir
|
|
|
|
}
|
|
|
|
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"
|
|
|
|
system "make"
|
|
|
|
system "make install" # seperate steps required, otherwise the build fails
|
2009-11-18 22:08:29 +00:00
|
|
|
|
|
|
|
if clang?
|
|
|
|
Dir.chdir clang_dir do
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
end
|
2009-08-31 13:45:04 +00:00
|
|
|
end
|
|
|
|
end
|