7bd947eb0b
* Use new "url" features * Use keg_only DSL * Use "skip_clean :all" DSL * Whitespace and style cleanups * Make bash invocations less silly * Use new man2-man8 helpers * Remove "FileUtils." since it is included in Formula * Use real names for deps instead of aliases * ENV.x11 now updates path, so remove that from individual brews
40 lines
1,012 B
Ruby
40 lines
1,012 B
Ruby
require 'formula'
|
|
|
|
def build_clang?; ARGV.include? '--with-clang'; end
|
|
|
|
class Clang <Formula
|
|
url 'http://llvm.org/releases/2.7/clang-2.7.tgz'
|
|
homepage 'http://llvm.org/'
|
|
md5 'b83260aa8c13494adf8978b5f238bf1b'
|
|
end
|
|
|
|
class Llvm <Formula
|
|
url 'http://llvm.org/releases/2.7/llvm-2.7.tgz'
|
|
homepage 'http://llvm.org/'
|
|
md5 'ac322661f20e7d6c810b1869f886ad9b'
|
|
|
|
def options
|
|
[['--with-clang', 'Also build & install clang']]
|
|
end
|
|
|
|
def install
|
|
ENV.gcc_4_2 # llvm can't compile itself
|
|
|
|
if build_clang?
|
|
clang_dir = Pathname.new(Dir.pwd)+'tools/clang'
|
|
Clang.new.brew { clang_dir.install Dir['*'] }
|
|
end
|
|
|
|
system "./configure", "--prefix=#{prefix}",
|
|
"--enable-targets=host-only",
|
|
"--enable-optimized"
|
|
system "make" # seperate steps required, otherwise the build fails
|
|
system "make install"
|
|
|
|
if build_clang?
|
|
Dir.chdir clang_dir do
|
|
system "make install"
|
|
end
|
|
end
|
|
end
|
|
end
|