homebrew-core/Formula/llvm.rb

109 lines
3.1 KiB
Ruby
Raw Normal View History

require 'formula'
2011-03-10 05:11:03 +00:00
class Llvm < Formula
homepage 'http://llvm.org/'
2014-05-15 19:07:39 +00:00
bottle do
sha1 "8136d3ef9c97e3de20ab4962f94a6c15ce5b50b2" => :mavericks
sha1 "15d12d15f17c3fa12f2b7e87ac1f70ae3eaa7e35" => :mountain_lion
sha1 "50e1d0c4a046ea14fb8c4bbd305bc7c8ccaac5bb" => :lion
2014-05-15 19:07:39 +00:00
end
stable do
url "http://llvm.org/releases/3.4.2/llvm-3.4.2.src.tar.gz"
sha1 "c5287384d0b95ecb0fd7f024be2cdfb60cd94bc9"
resource 'clang' do
url "http://llvm.org/releases/3.4.2/cfe-3.4.2.src.tar.gz"
sha1 "add5420b10c3c3a38c4dc2322f8b64ba0a5def97"
end
resource 'lld' do
url "http://llvm.org/releases/3.4/lld-3.4.src.tar.gz"
sha1 "1e8f2fe693d82fd0e3166fb60e017720eb1a5cf5"
end
end
head do
url "http://llvm.org/svn/llvm-project/llvm/trunk", :using => :svn
resource 'clang' do
url "http://llvm.org/svn/llvm-project/cfe/trunk", :using => :svn
end
resource 'lld' do
url "http://llvm.org/svn/llvm-project/lld/trunk", :using => :svn
end
2013-06-21 15:33:38 +00:00
end
option :universal
option 'with-clang', 'Build Clang support library'
option 'with-lld', 'Build LLD linker'
option 'disable-shared', "Don't build LLVM as a shared library"
option 'all-targets', 'Build all target backends'
option 'rtti', 'Build with C++ RTTI'
option 'disable-assertions', 'Speeds up LLVM, but provides less debug information'
2009-11-18 22:08:29 +00:00
depends_on :python => :optional
keg_only :provided_by_osx
def install
2014-01-24 04:49:15 +00:00
if build.with? "python" and build.include? 'disable-shared'
raise 'The Python bindings need the shared library.'
end
2014-05-12 19:37:24 +00:00
(buildpath/"tools/clang").install resource("clang") if build.with? "clang"
(buildpath/"tools/lld").install resource("lld") if build.with? "lld"
if build.universal?
2014-05-14 05:00:59 +00:00
ENV.permit_arch_flags
ENV['UNIVERSAL'] = '1'
ENV['UNIVERSAL_ARCH'] = Hardware::CPU.universal_archs.join(' ')
end
ENV['REQUIRES_RTTI'] = '1' if build.include? 'rtti'
args = [
"--prefix=#{prefix}",
"--enable-optimized",
# As of LLVM 3.1, attempting to build ocaml bindings with Homebrew's
# OCaml 3.12.1 results in errors.
"--disable-bindings",
]
if build.include? 'all-targets'
args << "--enable-targets=all"
else
args << "--enable-targets=host"
end
args << "--enable-shared" unless build.include? 'disable-shared'
args << "--disable-assertions" if build.include? 'disable-assertions'
system "./configure", *args
system 'make'
system 'make', 'install'
(share/'llvm/cmake').install buildpath/'cmake/modules'
2009-11-18 22:08:29 +00:00
# install llvm python bindings
2014-01-24 04:49:15 +00:00
if build.with? "python"
2014-01-04 13:09:42 +00:00
(lib+'python2.7/site-packages').install buildpath/'bindings/python/llvm'
(lib+'python2.7/site-packages').install buildpath/'tools/clang/bindings/python/clang' if build.with? 'clang'
end
end
2010-10-07 17:13:59 +00:00
test do
system "#{bin}/llvm-config", "--version"
2012-03-22 17:19:39 +00:00
end
def caveats
2014-01-04 13:09:42 +00:00
<<-EOS.undent
2014-07-07 15:34:52 +00:00
LLVM executables are installed in #{opt_bin}.
Extra tools are installed in #{opt_share}/llvm.
If you already have LLVM installed, then "brew upgrade llvm" might not work.
Instead, try:
brew rm llvm && brew install llvm
2010-10-07 17:13:59 +00:00
EOS
end
end