2011-03-10 05:11:03 +00:00
|
|
|
class Llvm < Formula
|
2015-01-15 17:20:17 +00:00
|
|
|
homepage "http://llvm.org/"
|
2014-05-15 19:07:39 +00:00
|
|
|
|
2014-07-16 22:29:28 +00:00
|
|
|
stable do
|
2015-01-15 17:09:50 +00:00
|
|
|
url "http://llvm.org/releases/3.5.1/llvm-3.5.1.src.tar.xz"
|
|
|
|
sha1 "79638cf00584b08fd6eeb1e73ea69b331561e7f6"
|
2014-12-17 05:46:26 +00:00
|
|
|
|
|
|
|
resource "clang" do
|
2015-01-15 17:09:50 +00:00
|
|
|
url "http://llvm.org/releases/3.5.1/cfe-3.5.1.src.tar.xz"
|
|
|
|
sha1 "39d79c0b40cec548a602dcac3adfc594b18149fe"
|
2014-07-16 22:29:28 +00:00
|
|
|
end
|
2014-12-17 05:46:26 +00:00
|
|
|
|
2014-12-30 21:02:21 +00:00
|
|
|
resource "libcxx" do
|
2015-01-15 17:09:50 +00:00
|
|
|
url "http://llvm.org/releases/3.5.1/libcxx-3.5.1.src.tar.xz"
|
|
|
|
sha1 "aa8d221f4db99f5a8faef6b594cbf7742cc55ad2"
|
2014-12-30 21:02:21 +00:00
|
|
|
end
|
|
|
|
|
2014-12-17 05:46:26 +00:00
|
|
|
resource "lld" do
|
2015-01-15 17:09:50 +00:00
|
|
|
url "http://llvm.org/releases/3.5.1/lld-3.5.1.src.tar.xz"
|
|
|
|
sha1 "9af270a79ae0aeb0628112073167495c43ab836a"
|
2014-07-23 07:23:38 +00:00
|
|
|
end
|
2014-12-31 01:27:37 +00:00
|
|
|
|
2015-01-26 14:02:33 +00:00
|
|
|
resource "lldb" do
|
|
|
|
url "http://llvm.org/releases/3.5.1/lldb-3.5.1.src.tar.xz"
|
|
|
|
sha1 "32728e25e6e513528c8c793ae65981150bec7c0d"
|
|
|
|
end
|
|
|
|
|
2014-12-31 01:27:37 +00:00
|
|
|
resource "clang-tools-extra" do
|
2015-01-15 17:09:50 +00:00
|
|
|
url "http://llvm.org/releases/3.5.1/clang-tools-extra-3.5.1.src.tar.xz"
|
|
|
|
sha1 "7a0dd880d7d8fe48bdf0f841eca318337d27a345"
|
2014-12-31 01:27:37 +00:00
|
|
|
end
|
2014-07-16 22:29:28 +00:00
|
|
|
end
|
|
|
|
|
2014-12-30 21:16:30 +00:00
|
|
|
bottle do
|
2015-01-15 18:31:41 +00:00
|
|
|
sha1 "3e2dd43db3c45a3bcf96174e0b195267f66f0307" => :yosemite
|
|
|
|
sha1 "e0314fabbc5791fb665225ca91602b3fdd745072" => :mavericks
|
|
|
|
sha1 "59857e2f5670c9edb4adfd3cc3f03af2411e9c30" => :mountain_lion
|
2014-12-30 21:16:30 +00:00
|
|
|
end
|
|
|
|
|
2014-07-16 22:29:28 +00:00
|
|
|
head do
|
2014-12-17 05:46:26 +00:00
|
|
|
url "http://llvm.org/git/llvm.git"
|
|
|
|
|
|
|
|
resource "clang" do
|
|
|
|
url "http://llvm.org/git/clang.git"
|
2014-07-16 22:29:28 +00:00
|
|
|
end
|
2014-12-17 05:46:26 +00:00
|
|
|
|
2014-12-30 21:02:21 +00:00
|
|
|
resource "libcxx" do
|
|
|
|
url "http://llvm.org/git/libcxx.git"
|
|
|
|
end
|
|
|
|
|
2014-12-17 05:46:26 +00:00
|
|
|
resource "lld" do
|
|
|
|
url "http://llvm.org/git/lld.git"
|
2014-07-23 07:23:38 +00:00
|
|
|
end
|
2014-12-31 01:27:37 +00:00
|
|
|
|
2015-01-26 14:02:33 +00:00
|
|
|
resource "lldb" do
|
|
|
|
url "http://llvm.org/git/lldb.git"
|
|
|
|
end
|
|
|
|
|
2014-12-31 01:27:37 +00:00
|
|
|
resource "clang-tools-extra" do
|
|
|
|
url "http://llvm.org/git/clang-tools-extra.git"
|
|
|
|
end
|
2013-06-21 15:33:38 +00:00
|
|
|
end
|
|
|
|
|
2014-12-30 18:57:30 +00:00
|
|
|
# Use absolute paths for shared library IDs
|
|
|
|
patch :DATA
|
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
option :universal
|
2015-01-15 17:20:17 +00:00
|
|
|
option "with-clang", "Build Clang support library"
|
|
|
|
option "with-lld", "Build LLD linker"
|
2015-01-26 14:02:33 +00:00
|
|
|
option "with-lldb", "Build LLDB debugger"
|
2015-01-15 17:20:17 +00:00
|
|
|
option "with-rtti", "Build with C++ RTTI"
|
2015-01-27 05:05:49 +00:00
|
|
|
option "with-python", "Build Python bindings against Homebrew Python"
|
2015-01-15 17:20:17 +00:00
|
|
|
option "without-shared", "Don't build LLVM as a shared library"
|
|
|
|
option "without-assertions", "Speeds up LLVM, but provides less debug information"
|
|
|
|
|
|
|
|
deprecated_option "rtti" => "with-rtti"
|
|
|
|
deprecated_option "disable-shared" => "without-shared"
|
|
|
|
deprecated_option "disable-assertions" => "without-assertions"
|
2009-11-18 22:08:29 +00:00
|
|
|
|
2015-01-27 05:05:49 +00:00
|
|
|
if MacOS.version <= :snow_leopard
|
|
|
|
depends_on :python
|
|
|
|
else
|
|
|
|
depends_on :python => :optional
|
|
|
|
end
|
2015-05-05 01:24:32 +00:00
|
|
|
depends_on "cmake" => :build
|
2015-01-26 14:02:33 +00:00
|
|
|
depends_on "swig" if build.with? "lldb"
|
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
|
|
|
|
|
2015-01-26 14:02:33 +00:00
|
|
|
if build.with?("lldb") && build.without?("clang")
|
|
|
|
fail "Building LLDB needs Clang support library."
|
|
|
|
end
|
|
|
|
|
2014-12-30 21:02:21 +00:00
|
|
|
if build.with? "clang"
|
|
|
|
(buildpath/"projects/libcxx").install resource("libcxx")
|
|
|
|
(buildpath/"tools/clang").install resource("clang")
|
2014-12-31 01:27:37 +00:00
|
|
|
(buildpath/"tools/clang/tools/extra").install resource("clang-tools-extra")
|
2014-12-30 21:02:21 +00:00
|
|
|
end
|
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"
|
2015-01-26 14:02:33 +00:00
|
|
|
(buildpath/"tools/lldb").install resource("lldb") if build.with? "lldb"
|
2014-07-23 07:23:38 +00:00
|
|
|
|
2012-08-13 15:55:01 +00:00
|
|
|
if build.universal?
|
2014-05-14 05:00:59 +00:00
|
|
|
ENV.permit_arch_flags
|
2015-01-15 17:20:17 +00:00
|
|
|
ENV["UNIVERSAL"] = "1"
|
|
|
|
ENV["UNIVERSAL_ARCH"] = Hardware::CPU.universal_archs.join(" ")
|
2010-12-08 22:43:28 +00:00
|
|
|
end
|
|
|
|
|
2015-01-15 17:20:17 +00:00
|
|
|
ENV["REQUIRES_RTTI"] = "1" if build.with?("rtti") || build.with?("clang")
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2015-05-05 01:24:32 +00:00
|
|
|
args = %w[
|
|
|
|
-DLLVM_OPTIMIZED_TABLEGEN=On
|
2011-12-03 22:56:37 +00:00
|
|
|
]
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2015-05-05 01:24:32 +00:00
|
|
|
args << "-DBUILD_SHARED_LIBS=Off" if build.without? "shared"
|
2011-01-09 18:32:58 +00:00
|
|
|
|
2015-05-05 01:24:32 +00:00
|
|
|
args << "-DLLVM_ENABLE_ASSERTIONS=On" if build.with? "assertions"
|
2012-12-06 20:21:07 +00:00
|
|
|
|
2015-05-05 01:24:32 +00:00
|
|
|
mktemp do
|
|
|
|
system "cmake", "-G", "Unix Makefiles", buildpath, *(std_cmake_args + args)
|
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
2014-12-30 21:02:21 +00:00
|
|
|
|
|
|
|
if build.with? "clang"
|
|
|
|
system "make", "-C", "projects/libcxx", "install",
|
|
|
|
"DSTROOT=#{prefix}", "SYMROOT=#{buildpath}/projects/libcxx"
|
2014-12-31 01:24:00 +00:00
|
|
|
|
|
|
|
(share/"clang/tools").install Dir["tools/clang/tools/scan-{build,view}"]
|
|
|
|
inreplace "#{share}/clang/tools/scan-build/scan-build", "$RealBin/bin/clang", "#{bin}/clang"
|
|
|
|
bin.install_symlink share/"clang/tools/scan-build/scan-build", share/"clang/tools/scan-view/scan-view"
|
|
|
|
man1.install_symlink share/"clang/tools/scan-build/scan-build.1"
|
2014-12-30 21:02:21 +00:00
|
|
|
end
|
2014-01-06 20:11:40 +00:00
|
|
|
|
2012-08-11 09:21:42 +00:00
|
|
|
# install llvm python bindings
|
2015-01-27 05:05:49 +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"
|
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.
|
2010-10-07 17:13:59 +00:00
|
|
|
EOS
|
|
|
|
end
|
2009-08-31 13:45:04 +00:00
|
|
|
end
|
2014-12-30 18:57:30 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
diff --git a/Makefile.rules b/Makefile.rules
|
|
|
|
index ebebc0a..b0bb378 100644
|
|
|
|
--- a/Makefile.rules
|
|
|
|
+++ b/Makefile.rules
|
|
|
|
@@ -599,7 +599,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
|
|
|
ifneq ($(HOST_OS),Darwin)
|
|
|
|
LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
|
|
|
|
else
|
|
|
|
- LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
|
|
|
|
+ LD.Flags += -Wl,-install_name
|
|
|
|
+ ifdef LOADABLE_MODULE
|
|
|
|
+ LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)"
|
|
|
|
+ else
|
|
|
|
+ LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)"
|
|
|
|
+ endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|