2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 13:45:04 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Llvm < Formula
|
2014-01-06 20:11:40 +00:00
|
|
|
homepage 'http://llvm.org/'
|
|
|
|
|
2014-05-15 19:07:39 +00:00
|
|
|
bottle do
|
2014-09-21 23:23:30 +00:00
|
|
|
sha1 "1fc5969edc5fcffbb3e958da00ff6a1c70606262" => :mavericks
|
|
|
|
sha1 "c30d6cc49521fb950bd76390878c9469a780b981" => :mountain_lion
|
|
|
|
sha1 "0e4178a7e094b9c77431a6f37f7dc2f72acb8389" => :lion
|
2014-05-15 19:07:39 +00:00
|
|
|
end
|
|
|
|
|
2014-07-16 22:29:28 +00:00
|
|
|
stable do
|
2014-09-18 06:20:01 +00:00
|
|
|
url "http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz"
|
|
|
|
sha1 "58d817ac2ff573386941e7735d30702fe71267d5"
|
2014-07-16 22:29:28 +00:00
|
|
|
resource 'clang' do
|
2014-09-18 06:20:01 +00:00
|
|
|
url "http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz"
|
|
|
|
sha1 "834cee2ed8dc6638a486d8d886b6dce3db675ffa"
|
2014-07-16 22:29:28 +00:00
|
|
|
end
|
2014-07-23 07:23:38 +00:00
|
|
|
resource 'lld' do
|
2014-09-18 06:20:01 +00:00
|
|
|
url "http://llvm.org/releases/3.5.0/lld-3.5.0.src.tar.xz"
|
|
|
|
sha1 "13c88e1442b482b3ffaff5934f0a2b51cab067e5"
|
2014-07-23 07:23:38 +00:00
|
|
|
end
|
2014-07-16 22:29:28 +00:00
|
|
|
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
|
2014-07-23 07:23:38 +00:00
|
|
|
resource 'lld' do
|
|
|
|
url "http://llvm.org/svn/llvm-project/lld/trunk", :using => :svn
|
|
|
|
end
|
2013-06-21 15:33:38 +00:00
|
|
|
end
|
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
option :universal
|
2013-09-01 19:57:42 +00:00
|
|
|
option 'with-clang', 'Build Clang support library'
|
2014-07-23 07:23:38 +00:00
|
|
|
option 'with-lld', 'Build LLD linker'
|
2013-01-21 09:33:56 +00:00
|
|
|
option 'disable-shared', "Don't build LLVM as a shared library"
|
2012-08-13 15:55:01 +00:00
|
|
|
option 'all-targets', 'Build all target backends'
|
|
|
|
option 'rtti', 'Build with C++ RTTI'
|
2012-12-06 20:21:07 +00:00
|
|
|
option 'disable-assertions', 'Speeds up LLVM, but provides less debug information'
|
2009-11-18 22:08:29 +00:00
|
|
|
|
2014-05-08 17:22:26 +00:00
|
|
|
depends_on :python => :optional
|
2013-01-21 09:33:56 +00:00
|
|
|
|
2013-11-15 22:31:39 +00:00
|
|
|
keg_only :provided_by_osx
|
|
|
|
|
2014-09-21 22:43:37 +00:00
|
|
|
# Apple's libstdc++ is too old to build LLVM
|
|
|
|
fails_with :gcc
|
|
|
|
fails_with :llvm
|
|
|
|
|
2013-05-14 22:49:33 +00:00
|
|
|
def install
|
2014-09-21 22:43:37 +00:00
|
|
|
# Apple's libstdc++ is too old to build LLVM
|
|
|
|
ENV.libcxx if ENV.compiler == :clang
|
|
|
|
|
2014-01-24 04:49:15 +00:00
|
|
|
if build.with? "python" and build.include? 'disable-shared'
|
2013-01-21 09:33:56 +00:00
|
|
|
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"
|
2013-01-12 21:40:46 +00:00
|
|
|
|
2014-07-23 07:23:38 +00:00
|
|
|
(buildpath/"tools/lld").install resource("lld") if build.with? "lld"
|
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
if build.universal?
|
2014-05-14 05:00:59 +00:00
|
|
|
ENV.permit_arch_flags
|
2010-12-08 22:43:28 +00:00
|
|
|
ENV['UNIVERSAL'] = '1'
|
2013-08-02 03:51:36 +00:00
|
|
|
ENV['UNIVERSAL_ARCH'] = Hardware::CPU.universal_archs.join(' ')
|
2010-12-08 22:43:28 +00:00
|
|
|
end
|
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
ENV['REQUIRES_RTTI'] = '1' if build.include? 'rtti'
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
args = [
|
2011-12-03 22:56:37 +00:00
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--enable-optimized",
|
2012-08-11 09:21:42 +00:00
|
|
|
# As of LLVM 3.1, attempting to build ocaml bindings with Homebrew's
|
|
|
|
# OCaml 3.12.1 results in errors.
|
|
|
|
"--disable-bindings",
|
2011-12-03 22:56:37 +00:00
|
|
|
]
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
if build.include? 'all-targets'
|
|
|
|
args << "--enable-targets=all"
|
2011-05-11 22:32:19 +00:00
|
|
|
else
|
2012-08-13 15:55:01 +00:00
|
|
|
args << "--enable-targets=host"
|
2011-05-11 22:32:19 +00:00
|
|
|
end
|
2013-01-21 09:33:56 +00:00
|
|
|
args << "--enable-shared" unless build.include? 'disable-shared'
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2012-12-06 20:21:07 +00:00
|
|
|
args << "--disable-assertions" if build.include? 'disable-assertions'
|
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
system "./configure", *args
|
2014-01-06 20:11:40 +00:00
|
|
|
system 'make'
|
|
|
|
system 'make', 'install'
|
|
|
|
|
|
|
|
(share/'llvm/cmake').install buildpath/'cmake/modules'
|
2009-11-18 22:08:29 +00:00
|
|
|
|
2012-08-11 09:21:42 +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'
|
2013-01-21 09:33:56 +00:00
|
|
|
end
|
2009-08-31 13:45:04 +00:00
|
|
|
end
|
2010-10-07 17:13:59 +00:00
|
|
|
|
2014-02-23 21:31:41 +00:00
|
|
|
test do
|
2012-05-15 21:36:45 +00:00
|
|
|
system "#{bin}/llvm-config", "--version"
|
2012-03-22 17:19:39 +00:00
|
|
|
end
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
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.
|
2012-08-11 09:21:42 +00:00
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
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
|
2009-08-31 13:45:04 +00:00
|
|
|
end
|