Browse code

Add lldb, clang, and llvm. (Bug 1794114)

Change-Id: I59e06d6d8d653841b4fa0611c0e2927e20565335
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1964
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Divya Thaluru <dthaluru@vmware.com>

xiaolin-vmware authored on 2017/01/27 04:55:38
Showing 6 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,79 @@
0
+Summary:        C, C++, Objective C and Objective C++ front-end for the LLVM compiler.
1
+Name:           clang
2
+Version:        3.9.1
3
+Release:        1%{?dist}
4
+License:        NCSA
5
+URL:            http://clang.llvm.org
6
+Group:          Development/Tools
7
+Vendor:         VMware, Inc.
8
+Distribution:   Photon
9
+Source0:        http://releases.llvm.org/%{version}/cfe-%{version}.src.tar.xz
10
+%define sha1    cfe=95e4be54b70f32cf98a8de36821ea5495b84add8
11
+BuildRequires:  cmake
12
+BuildRequires:  llvm-devel = %{version}
13
+BuildRequires:  ncurses-devel
14
+BuildRequires:  zlib-devel
15
+BuildRequires:  libxml2-devel
16
+BuildRequires:  python2-devel
17
+Requires:       libstdc++-devel
18
+Requires:       ncurses
19
+Requires:       llvm
20
+Requires:       zlib
21
+Requires:       libxml2
22
+Requires:       python2
23
+
24
+%description
25
+The goal of the Clang project is to create a new C based language front-end: C, C++, Objective C/C++, OpenCL C and others for the LLVM compiler. You can get and build the source today.
26
+
27
+%package devel
28
+Summary:        Development headers for clang
29
+Requires:       %{name} = %{version}-%{release}
30
+
31
+%description devel
32
+The clang-devel package contains libraries, header files and documentation
33
+for developing applications that use clang.
34
+
35
+%prep
36
+%setup -q -n cfe-%{version}.src
37
+
38
+%build
39
+mkdir -p build
40
+cd build
41
+cmake -DCMAKE_INSTALL_PREFIX=/usr   \
42
+      -DCMAKE_BUILD_TYPE=Release    \
43
+      -Wno-dev ..
44
+
45
+make %{?_smp_mflags}
46
+
47
+%install
48
+[ %{buildroot} != "/"] && rm -rf %{buildroot}/*
49
+cd build
50
+make DESTDIR=%{buildroot} install
51
+
52
+%post   -p /sbin/ldconfig
53
+%postun -p /sbin/ldconfig
54
+
55
+%check
56
+make %{?_smp_mflags} check
57
+
58
+%clean
59
+rm -rf %{buildroot}/*
60
+
61
+%files
62
+%defattr(-,root,root)
63
+%{_bindir}/*
64
+%{_libexecdir}/*
65
+%{_libdir}/*.so.*
66
+%{_datadir}/*
67
+
68
+%files devel
69
+%defattr(-,root,root)
70
+%{_libdir}/*.so
71
+%{_libdir}/*.a
72
+%{_libdir}/cmake/*
73
+%{_libdir}/clang/*
74
+%{_includedir}/*
75
+
76
+%changelog
77
+*   Wed Jan 11 2017 Xiaolin Li <xiaolinl@vmware.com>  3.9.1-1
78
+-   Initial build.
0 79
new file mode 100644
... ...
@@ -0,0 +1,196 @@
0
+SUMMARY
1
+Remove MIUtilParse once https://reviews.llvm.org/D23882 is accepted.
2
+
3
+From:
4
+https://reviews.llvm.org/file/data/e4yr2fu3vndsceyt6xv7/PHID-FILE-pgisidny2ro3tylncbpm/D23883.diff
5
+
6
+Index: tools/lldb-mi/CMakeLists.txt
7
+===================================================================
8
+--- tools/lldb-mi/CMakeLists.txt
9
+@@ -65,7 +65,6 @@
10
+   MIDriverBase.cpp
11
+   MIDriverMain.cpp
12
+   MIDriverMgr.cpp
13
+-  MIUtilParse.cpp
14
+   MIUtilDateTimeStd.cpp
15
+   MIUtilDebug.cpp
16
+   MIUtilFileStd.cpp
17
+Index: tools/lldb-mi/MIUtilParse.h
18
+===================================================================
19
+--- tools/lldb-mi/MIUtilParse.h
20
+@@ -1,93 +0,0 @@
21
+-//===-- MIUtilParse.h ------------------------------------------*- C++ -*-===//
22
+-//
23
+-//                     The LLVM Compiler Infrastructure
24
+-//
25
+-// This file is distributed under the University of Illinois Open Source
26
+-// License. See LICENSE.TXT for details.
27
+-//
28
+-//===----------------------------------------------------------------------===//
29
+- 
30
+-#pragma once
31
+- 
32
+-// Third party headers:
33
+-#include "../lib/Support/regex_impl.h"
34
+-
35
+-// In-house headers:
36
+-#include "MIUtilString.h"
37
+- 
38
+-namespace MIUtilParse
39
+-{
40
+- 
41
+-//++ ============================================================================
42
+-// Details: MI common code utility class. Used to parse the output
43
+-//          returned from lldb commands using regex.
44
+-//--
45
+-class CRegexParser
46
+-{
47
+-  public:
48
+-    // Helper class for keeping track of regex matches.
49
+-    class Match
50
+-    {
51
+-        friend CRegexParser;
52
+-      public:
53
+-        /* ctor */ explicit Match(size_t nmatches)
54
+-            : m_matchStrs(nmatches), m_maxMatches(nmatches)
55
+-        {
56
+-        }
57
+-        size_t
58
+-        GetMatchCount() const
59
+-        {
60
+-            return m_matchStrs.size();
61
+-        }
62
+-        CMIUtilString
63
+-        GetMatchAtIndex(size_t i) const
64
+-        {
65
+-            if (m_matchStrs.size() > i)
66
+-                return m_matchStrs[i];
67
+-            return CMIUtilString();
68
+-        }
69
+-      private:
70
+-        CMIUtilString::VecString_t m_matchStrs;
71
+-        const size_t m_maxMatches;
72
+-    };
73
+- 
74
+-    // Methods:
75
+-    // Compile the regular expression.
76
+-    /* ctor */ explicit CRegexParser(const char *regexStr);
77
+- 
78
+-    // Free the memory used by the regular expression.
79
+-    /* dtor */ ~CRegexParser();
80
+- 
81
+-    // No copies
82
+-    CRegexParser(const CRegexParser&) = delete;
83
+-    void operator=(CRegexParser&) = delete;
84
+- 
85
+-    // Return the match at the index.
86
+-    int
87
+-    GetMatchCount(const Match& match) const
88
+-    {
89
+-        if (m_isValid)
90
+-            return match.GetMatchCount();
91
+-        return 0;
92
+-    }
93
+- 
94
+-    bool
95
+-    IsValid() const
96
+-    {
97
+-        return m_isValid;
98
+-    }
99
+- 
100
+-    // Match the input against the regular expression.  Return an error
101
+-    // if the number of matches is less than minMatches.  If the default
102
+-    // minMatches value of 0 is passed, an error will be returned if
103
+-    // the number of matches is less than the maxMatches value used to
104
+-    // initialize Match.
105
+-    bool
106
+-    Execute(const char *input, Match& match, size_t minMatches = 0);
107
+- 
108
+-  private:
109
+-    llvm_regex_t m_emma;
110
+-    const bool m_isValid;
111
+-};
112
+-
113
+-}
114
+Index: tools/lldb-mi/MIUtilParse.cpp
115
+===================================================================
116
+--- tools/lldb-mi/MIUtilParse.cpp
117
+@@ -1,75 +0,0 @@
118
+-//===-- MIUtilParse.cpp ----------------------------------------*- C++ -*-===//
119
+-//
120
+-//                     The LLVM Compiler Infrastructure
121
+-//
122
+-// This file is distributed under the University of Illinois Open Source
123
+-// License. See LICENSE.TXT for details.
124
+-//
125
+-//===----------------------------------------------------------------------===//
126
+- 
127
+-// Third party headers:
128
+-#include <memory>
129
+-
130
+-// In-house headers:
131
+-#include "MIUtilParse.h"
132
+- 
133
+-//++ ------------------------------------------------------------------------------------
134
+-// Details: CRegexParser constructor.
135
+-// Type:    Method.
136
+-// Args:    regexStr - Pointer to the regular expression to compile.
137
+-// Return:  None.
138
+-// Throws:  None.
139
+-//--
140
+-MIUtilParse::CRegexParser::CRegexParser(const char *regexStr)
141
+-    : m_isValid(llvm_regcomp(&m_emma, regexStr, REG_EXTENDED) == 0)
142
+-{
143
+-}
144
+- 
145
+-//++ ------------------------------------------------------------------------------------
146
+-// Details: CRegexParser destructor.
147
+-// Type:    Method.
148
+-// Args:    None.
149
+-// Return:  None.
150
+-// Throws:  None.
151
+-//--
152
+-MIUtilParse::CRegexParser::~CRegexParser()
153
+-{
154
+-    // Free up memory held within regex.
155
+-    if (m_isValid)
156
+-        llvm_regfree(&m_emma);
157
+-}
158
+- 
159
+-//++ ------------------------------------------------------------------------------------
160
+-// Details: CRegexParser regex executer.
161
+-//          Match the input against the regular expression.  Return an error
162
+-//          if the number of matches is less than minMatches.  If the default
163
+-//          minMatches value of 0 is passed, an error will be returned if
164
+-//          the number of matches is less than the maxMatches value used to
165
+-//          initialize Match.
166
+-// Type:    Method.
167
+-// Args:    input (R) - Pointer to UTF8 text data to be parsed.
168
+-//          match (RW) - Reference to Match class.
169
+-//          minMatches (R) - Minimum number of regex matches expected.
170
+-// Return:  bool - True = minimum matches were met,
171
+-//                 false = minimum matches were not met or regex failed.
172
+-// Throws:  None.
173
+-//--
174
+-bool
175
+-MIUtilParse::CRegexParser::Execute(const char *input, Match& match, size_t minMatches)
176
+-{
177
+-    if (!m_isValid)
178
+-        return false;
179
+- 
180
+-    std::unique_ptr<llvm_regmatch_t[]> matches(new llvm_regmatch_t[match.m_maxMatches]); // Array of matches
181
+-   
182
+-    if (llvm_regexec(&m_emma, input, match.m_maxMatches, matches.get(), 0) != 0)
183
+-        return false;
184
+- 
185
+-    size_t i;
186
+-    for (i = 0; i < match.m_maxMatches && matches[i].rm_so >= 0; i++)
187
+-    {
188
+-        const int n = matches[i].rm_eo - matches[i].rm_so;
189
+-        match.m_matchStrs[i].assign(input + matches[i].rm_so, n);
190
+-    }
191
+-    return i >= minMatches;
192
+-}
0 193
new file mode 100644
... ...
@@ -0,0 +1,146 @@
0
+SUMMARY
1
+Replace uses of the local MIUtilParse::CRegexParser class with the LLVM support class llvm::Regex. This reduces duplication of code, and makes it possible to remove the MIUtilParse::CRegexParser class that requires LLVM internal implementation headers.
2
+
3
+Bug: https://llvm.org/bugs/show_bug.cgi?id=29138
4
+
5
+From:
6
+https://reviews.llvm.org/file/data/ne2lqkdbc54c2ismicnp/PHID-FILE-nxy5llvyrv2t6fgjeqef/D23882.diff
7
+Index: tools/lldb-mi/MICmdCmdData.cpp
8
+===================================================================
9
+--- tools/lldb-mi/MICmdCmdData.cpp
10
+@@ -25,6 +25,9 @@
11
+ #include "lldb/API/SBInstruction.h"
12
+ #include "lldb/API/SBInstructionList.h"
13
+ #include "lldb/API/SBStream.h"
14
++#include "llvm/ADT/SmallVector.h"
15
++#include "llvm/ADT/StringRef.h"
16
++#include "llvm/Support/Regex.h"
17
+ 
18
+ // In-house headers:
19
+ #include "MICmdCmdData.h"
20
+@@ -42,7 +45,6 @@
21
+ #include "MICmdArgValConsume.h"
22
+ #include "MICmnLLDBDebugSessionInfoVarObj.h"
23
+ #include "MICmnLLDBUtilSBValue.h"
24
+-#include "MIUtilParse.h"
25
+ 
26
+ //++ ------------------------------------------------------------------------------------
27
+ // Details: CMICmdCmdDataEvaluateExpression constructor.
28
+@@ -1651,24 +1653,24 @@
29
+     // is remains is assumed to be the filename.
30
+ 
31
+     // Match LineEntry using regex.
32
+-    static MIUtilParse::CRegexParser g_lineentry_nocol_regex( 
33
+-        "^ *LineEntry: \\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$");
34
+-    static MIUtilParse::CRegexParser g_lineentry_col_regex( 
35
+-        "^ *LineEntry: \\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$");
36
+-        //                ^1=start         ^2=end               ^3=f ^4=line ^5=:col(opt)
37
++    static llvm::Regex g_lineentry_nocol_regex(
38
++        llvm::StringRef("^ *LineEntry: \\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"));
39
++    static llvm::Regex g_lineentry_col_regex(
40
++        llvm::StringRef("^ *LineEntry: \\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"));
41
++        //                                ^1=start         ^2=end               ^3=f ^4=line ^5=:col(opt)
42
+ 
43
+-    MIUtilParse::CRegexParser::Match match(6);
44
++    llvm::SmallVector<llvm::StringRef, 6> match;
45
+ 
46
+     // First try matching the LineEntry with the column,
47
+     // then try without the column.
48
+-    const bool ok = g_lineentry_col_regex.Execute(input, match) ||
49
+-                    g_lineentry_nocol_regex.Execute(input, match);
50
++    const bool ok = g_lineentry_col_regex.match(input, &match) ||
51
++                    g_lineentry_nocol_regex.match(input, &match);
52
+     if (ok)
53
+     {
54
+-        start = match.GetMatchAtIndex(1);
55
+-        end   = match.GetMatchAtIndex(2);
56
+-        file  = match.GetMatchAtIndex(3);
57
+-        line  = match.GetMatchAtIndex(4);
58
++        start = match[1];
59
++        end   = match[2];
60
++        file  = match[3];
61
++        line  = match[4];
62
+     }
63
+     return ok;
64
+ }
65
+Index: tools/lldb-mi/MICmdCmdSymbol.cpp
66
+===================================================================
67
+--- tools/lldb-mi/MICmdCmdSymbol.cpp
68
+@@ -11,15 +11,17 @@
69
+ 
70
+ // Third Party Headers:
71
+ #include "lldb/API/SBCommandInterpreter.h"
72
++#include "llvm/ADT/SmallVector.h"
73
++#include "llvm/ADT/StringRef.h"
74
++#include "llvm/Support/Regex.h"
75
+ 
76
+ // In-house headers:
77
+ #include "MICmdArgValFile.h"
78
+ #include "MICmdCmdSymbol.h"
79
+ #include "MICmnLLDBDebugSessionInfo.h"
80
+ #include "MICmnMIResultRecord.h"
81
+ #include "MICmnMIValueList.h"
82
+ #include "MICmnMIValueTuple.h"
83
+-#include "MIUtilParse.h"
84
+ 
85
+ //++ ------------------------------------------------------------------------------------
86
+ // Details: CMICmdCmdSymbolListLines constructor.
87
+@@ -105,15 +107,15 @@
88
+ ParseLLDBLineAddressHeader(const char *input, CMIUtilString &file)
89
+ {
90
+     // Match LineEntry using regex.
91
+-    static MIUtilParse::CRegexParser g_lineentry_header_regex( 
92
+-        "^ *Lines found for file (.+) in compilation unit (.+) in `(.+)$");
93
+-        //                       ^1=file                  ^2=cu    ^3=module
94
++    static llvm::Regex g_lineentry_header_regex(
95
++        llvm::StringRef("^ *Lines found for file (.+) in compilation unit (.+) in `(.+)$"));
96
++        //                                       ^1=file                  ^2=cu    ^3=module
97
+ 
98
+-    MIUtilParse::CRegexParser::Match match(4);
99
++    llvm::SmallVector<llvm::StringRef, 4> match;
100
+ 
101
+-    const bool ok = g_lineentry_header_regex.Execute(input, match);
102
++    const bool ok = g_lineentry_header_regex.match(input, &match);
103
+     if (ok)
104
+-        file = match.GetMatchAtIndex(1);
105
++        file = match[1];
106
+     return ok;
107
+ }
108
+ 
109
+@@ -141,23 +143,23 @@
110
+     // is remains is assumed to be the filename.
111
+ 
112
+     // Match LineEntry using regex.
113
+-    static MIUtilParse::CRegexParser g_lineentry_nocol_regex( 
114
+-        "^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$");
115
+-    static MIUtilParse::CRegexParser g_lineentry_col_regex( 
116
+-        "^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$");
117
+-        //     ^1=start         ^2=end               ^3=f ^4=line ^5=:col(opt)
118
++    static llvm::Regex g_lineentry_nocol_regex(
119
++        llvm::StringRef("^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"));
120
++    static llvm::Regex g_lineentry_col_regex(
121
++        llvm::StringRef("^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"));
122
++        //                     ^1=start         ^2=end               ^3=f ^4=line ^5=:col(opt)
123
+ 
124
+-    MIUtilParse::CRegexParser::Match match(6);
125
++    llvm::SmallVector<llvm::StringRef, 6> match;
126
+ 
127
+     // First try matching the LineEntry with the column,
128
+     // then try without the column.
129
+-    const bool ok = g_lineentry_col_regex.Execute(input, match) ||
130
+-                    g_lineentry_nocol_regex.Execute(input, match);
131
++    const bool ok = g_lineentry_col_regex.match(input, &match) ||
132
++                    g_lineentry_nocol_regex.match(input, &match);
133
+     if (ok)
134
+     {
135
+-        addr = match.GetMatchAtIndex(1);
136
+-        file = match.GetMatchAtIndex(3);
137
+-        line = match.GetMatchAtIndex(4);
138
++        addr = match[1];
139
++        file = match[3];
140
++        line = match[4];
141
+     }
142
+     return ok;
143
+ }
0 144
new file mode 100644
... ...
@@ -0,0 +1,85 @@
0
+Summary:        A next generation, high-performance debugger.
1
+Name:           lldb
2
+Version:        3.9.1
3
+Release:        1%{?dist}
4
+License:        NCSA
5
+URL:            http://lldb.llvm.org
6
+Group:          Development/Tools
7
+Vendor:         VMware, Inc.
8
+Distribution:   Photon
9
+Source0:        http://releases.llvm.org/%{version}/%{name}-%{version}.src.tar.xz
10
+%define sha1    lldb=f6da59c9ed570c4c7091c25f0abe59aba0e29de3
11
+Patch0:         Replace-uses-of-MIUtilParse-CRegexParser-with-llvm-Regex.patch
12
+Patch1:         Remove-MIUtilParse.patch
13
+BuildRequires:  cmake
14
+BuildRequires:  llvm-devel = %{version}
15
+BuildRequires:  clang-devel = %{version}
16
+BuildRequires:  ncurses-devel
17
+BuildRequires:  swig
18
+BuildRequires:  zlib-devel
19
+BuildRequires:  libxml2-devel
20
+BuildRequires:  python2-devel
21
+Requires:       llvm = %{version}
22
+Requires:       clang = %{version}
23
+Requires:       ncurses
24
+Requires:       zlib
25
+Requires:       libxml2
26
+
27
+%description
28
+LLDB is a next generation, high-performance debugger. It is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler.
29
+
30
+%package devel
31
+Summary:        Development headers for lldb
32
+Requires:       %{name} = %{version}-%{release}
33
+
34
+%description devel
35
+The lldb-devel package contains libraries, header files and documentation
36
+for developing applications that use lldb.
37
+
38
+%prep
39
+%setup -q -n %{name}-%{version}.src
40
+%patch0
41
+%patch1
42
+
43
+%build
44
+mkdir -p build
45
+cd build
46
+cmake -DCMAKE_INSTALL_PREFIX=/usr           \
47
+      -DCMAKE_BUILD_TYPE=Release            \
48
+      -DLLDB_PATH_TO_LLVM_BUILD=%{_prefix}  \
49
+      -DLLDB_PATH_TO_CLANG_BUILD=%{_prefix} \
50
+      -DLLVM_DIR=/usr/lib/cmake/llvm        \
51
+      -DLLVM_BUILD_LLVM_DYLIB=ON ..         \
52
+      -DLLDB_DISABLE_LIBEDIT:BOOL=ON
53
+
54
+make %{?_smp_mflags}
55
+
56
+%install
57
+[ %{buildroot} != "/"] && rm -rf %{buildroot}/*
58
+cd build
59
+make DESTDIR=%{buildroot} install
60
+
61
+%post   -p /sbin/ldconfig
62
+%postun -p /sbin/ldconfig
63
+
64
+%check
65
+make %{?_smp_mflags} check
66
+
67
+%clean
68
+rm -rf %{buildroot}/*
69
+
70
+%files
71
+%defattr(-,root,root)
72
+%{_bindir}/*
73
+%{_libdir}/python2.7/*
74
+%{_libdir}/liblldb.so.*
75
+
76
+%files devel
77
+%defattr(-,root,root)
78
+%{_libdir}/liblldb.so
79
+%{_libdir}/*.a
80
+%{_includedir}/*
81
+
82
+%changelog
83
+*   Wed Jan 11 2017 Xiaolin Li <xiaolinl@vmware.com>  3.9.1-1
84
+-   Initial build.
0 85
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+cmake: Install CheckAtomic.cmake (needed by lldb)
1
+
2
+Summary:
3
+Install CheckAtomic.cmake along with other LLVM modules, therefore making it possible for other projects to use it. This file is needed for LLDB to be built standalone, and installing it was suggested in https://reviews.llvm.org/D23881.
4
+
5
+Patch by: Michał Górny
6
+
7
+Reviewers: krytarowski, zturner, eugenis, jyknight, labath, beanz
8
+
9
+Subscribers: beanz, llvm-commits
10
+
11
+Differential Revision: https://reviews.llvm.org/D23887
12
+Index: llvm/trunk/cmake/modules/CMakeLists.txt
13
+===================================================================
14
+--- a/cmake/modules/CMakeLists.txt
15
+@@ -91,6 +91,5 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
16
+     PATTERN LLVMConfig.cmake EXCLUDE
17
+     PATTERN LLVMConfigVersion.cmake EXCLUDE
18
+     PATTERN LLVM-Config.cmake EXCLUDE
19
+-    PATTERN GetHostTriple.cmake EXCLUDE
20
+-    PATTERN CheckAtomic.cmake EXCLUDE)
21
++    PATTERN GetHostTriple.cmake EXCLUDE)
22
+ endif()
0 23
new file mode 100644
... ...
@@ -0,0 +1,69 @@
0
+Summary:        A collection of modular and reusable compiler and toolchain technologies.
1
+Name:           llvm
2
+Version:        3.9.1
3
+Release:        1%{?dist}
4
+License:        NCSA
5
+URL:            http://lldb.llvm.org
6
+Group:          Development/Tools
7
+Vendor:         VMware, Inc.
8
+Distribution:   Photon
9
+Source0:        http://releases.llvm.org/%{version}/%{name}-%{version}.src.tar.xz
10
+%define sha1    llvm=6349f3aa23250d6c56d709946415237e665a2d0d
11
+Patch0:         Install-CheckAtomic.cmake-needed-by-lldb.patch
12
+BuildRequires:  cmake
13
+BuildRequires:  libxml2-devel
14
+Requires:       libxml2
15
+
16
+%description
17
+The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. The name "LLVM" itself is not an acronym; it is the full name of the project.
18
+
19
+%package devel
20
+Summary:        Development headers for llvm
21
+Requires:       %{name} = %{version}-%{release}
22
+
23
+%description devel
24
+The llvm-devel package contains libraries, header files and documentation
25
+for developing applications that use llvm.
26
+
27
+%prep
28
+%setup -q -n %{name}-%{version}.src
29
+#%patch0 -p1
30
+
31
+%build
32
+mkdir -p build
33
+cd build
34
+cmake -DCMAKE_INSTALL_PREFIX=/usr           \
35
+      -DLLVM_ENABLE_FFI=ON                  \
36
+      -DCMAKE_BUILD_TYPE=Release            \
37
+      -DLLVM_BUILD_LLVM_DYLIB=ON            \
38
+      -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" \
39
+      -Wno-dev ..
40
+
41
+make %{?_smp_mflags}
42
+%install
43
+[ %{buildroot} != "/"] && rm -rf %{buildroot}/*
44
+cd build
45
+make DESTDIR=%{buildroot} install
46
+
47
+%post   -p /sbin/ldconfig
48
+%postun -p /sbin/ldconfig
49
+
50
+%check
51
+make %{?_smp_mflags} check
52
+
53
+%clean
54
+rm -rf %{buildroot}/*
55
+
56
+%files
57
+%defattr(-,root,root)
58
+%{_bindir}/*
59
+%{_libdir}/*.so
60
+
61
+%files devel
62
+%{_libdir}/*.a
63
+%{_libdir}/cmake/*
64
+%{_includedir}/*
65
+
66
+%changelog
67
+*   Wed Jan 11 2017 Xiaolin Li <xiaolinl@vmware.com>  3.9.1-1
68
+-   Initial build.