homebrew-core/Formula/llvm.rb

56 lines
1.4 KiB
Ruby
Raw Normal View History

require 'formula'
2010-06-05 17:27:11 +00:00
def build_clang?; ARGV.include? '--with-clang'; end
def build_universal?; ARGV.include? '--universal'; end
2010-06-05 17:27:11 +00:00
2009-11-18 22:08:29 +00:00
class Clang <Formula
url 'http://llvm.org/releases/2.8/clang-2.8.tgz'
2009-11-18 22:08:29 +00:00
homepage 'http://llvm.org/'
md5 '10e14c901fc3728eecbd5b829e011b59'
2009-11-18 22:08:29 +00:00
end
class Llvm <Formula
url 'http://llvm.org/releases/2.8/llvm-2.8.tgz'
2009-11-18 22:08:29 +00:00
homepage 'http://llvm.org/'
2010-10-07 01:52:50 +00:00
md5 '220d361b4d17051ff4bb21c64abe05ba'
2009-11-18 22:08:29 +00:00
def options
[['--with-clang', 'Also build & install clang'],
['--universal', 'Build both i386 and x86_64 architectures']]
2009-11-18 22:08:29 +00:00
end
def install
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'
Clang.new.brew { clang_dir.install Dir['*'] }
2009-11-18 22:08:29 +00:00
end
if build_universal?
ENV['UNIVERSAL'] = '1'
ENV['UNIVERSAL_ARCH'] = 'i386 x86_64'
end
system "./configure", "--prefix=#{prefix}",
2009-11-16 12:45:52 +00:00
"--enable-targets=host-only",
"--enable-optimized"
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
end
2010-10-07 17:13:59 +00:00
def caveats; <<-EOS
If you already have LLVM installed, then "brew upgrade llvm" might not
work. Instead, try:
$ brew rm llvm
$ brew install llvm
EOS
end
end