forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llvm31.rb
81 lines (63 loc) · 2.14 KB
/
llvm31.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require 'formula'
class Clang31 < Formula
homepage 'http://llvm.org/'
url 'http://llvm.org/releases/3.1/clang-3.1.src.tar.gz'
sha1 '19f33b187a50d22fda2a6f9ed989699a9a9efd62'
head 'http://llvm.org/git/clang.git'
end
class Llvm31 < Formula
homepage 'http://llvm.org/'
url 'http://llvm.org/releases/3.1/llvm-3.1.src.tar.gz'
sha1 '234c96e73ef81aec9a54da92fc2a9024d653b059'
head 'http://llvm.org/git/llvm.git'
option :universal
option 'with-clang', 'Build Clang C/ObjC/C++ frontend'
option 'shared', 'Build LLVM as a shared library'
option 'all-targets', 'Build all target backends'
option 'rtti', 'Build with C++ RTTI'
env :std if build.universal?
def install
Clang31.new("clang").brew { clang_dir.install Dir['*'] } if build.include? 'with-clang'
if build.universal?
ENV['UNIVERSAL'] = '1'
ENV['UNIVERSAL_ARCH'] = 'i386 x86_64'
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" if build.include? 'shared'
system "./configure", *args
system "make install"
# install llvm python bindings
(share/'llvm/bindings').install buildpath/'bindings/python'
# install clang tools and bindings
cd clang_dir do
system 'make install'
(share/'clang/tools').install 'tools/scan-build', 'tools/scan-view'
(share/'clang/bindings').install 'bindings/python'
end if build.include? 'with-clang'
end
def test
system "#{bin}/llvm-config", "--version"
end
def caveats; <<-EOS.undent
Extra tools and bindings are installed in #{share}/llvm and #{share}/clang.
If you already have LLVM installed, then "brew upgrade llvm" might not work.
Instead, try:
brew rm llvm && brew install llvm
EOS
end
def clang_dir
buildpath/'tools/clang'
end
end