-
Notifications
You must be signed in to change notification settings - Fork 2
/
llvm-omp.rb
55 lines (40 loc) · 1.28 KB
/
llvm-omp.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
require 'formula'
class LlvmOmp < Formula
head "https://github.com/clang-omp/llvm.git"
homepage 'http://clang-omp.github.io/'
resource "compiler-rt" do
url "https://github.com/clang-omp/compiler-rt.git"
end
resource "clang-omp" do
url 'https://github.com/clang-omp/clang.git', :branch => 'clang-omp'
end
def add_suffix(filename, suffix)
dir = File.dirname(filename)
ext = File.extname(filename)
base = File.basename(filename, ext)
File.rename filename, "#{dir}/#{base}-#{suffix}#{ext}"
end
def install
version_suffix = "omp"
(buildpath/'projects/compiler-rt').install resource('compiler-rt')
(buildpath/'tools/clang').install resource('clang-omp')
mkdir "build"
cd "build"
args = [
"--prefix=#{prefix}",
"--enable-libcpp",
"--enable-cxx11",
"--enable-optimized",
]
# Will eventually want this in args when it's implemented.
# "--program-suffix=#{version_suffix}"
system "../configure", *args
system "make"
cd "tools/clang"
system "make install"
# clang ignores "--program-suffix" so we have to do it manually
Dir.glob(bin/"*") { |f| add_suffix f, version_suffix }
# Rename man1
Dir.glob(man1/"*.1") { |f| add_suffix f, version_suffix }
end
end