1 |
commit: 861716fce0066319fce54243dab1aa805e04aeff |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 29 14:36:17 2017 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 29 14:36:26 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=861716fc |
7 |
|
8 |
sys-libs/tapi: version bump to support recent ld64 by Michael Weiser |
9 |
|
10 |
I made some small changes to use a tarball because repoman does not |
11 |
permit a live-ebuild (one that uses git-r3) to be in the tree unmasked. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/642292 |
14 |
Package-Manager: Portage-2.3.13, Repoman-2.3.3 |
15 |
|
16 |
sys-libs/tapi/Manifest | 4 + |
17 |
.../files/objcmetadata-800.0.42.1-standalone.patch | 130 +++++++++++++++ |
18 |
sys-libs/tapi/files/tapi-2.0.0-standalone.patch | 141 ++++++++++++++++ |
19 |
sys-libs/tapi/tapi-2.0.0.ebuild | 177 +++++++++++++++++++++ |
20 |
4 files changed, 452 insertions(+) |
21 |
|
22 |
diff --git a/sys-libs/tapi/Manifest b/sys-libs/tapi/Manifest |
23 |
index 5993a858a41..cf5af5026f1 100644 |
24 |
--- a/sys-libs/tapi/Manifest |
25 |
+++ b/sys-libs/tapi/Manifest |
26 |
@@ -1 +1,5 @@ |
27 |
+DIST cfe-5.0.1.src.tar.xz 11483036 BLAKE2B c4eb54cd8271b62cf7a2219db0b599b68c00b6e574d1946220efbd1633e841796e6717d6eeb35e84a6db32a731a3285b59cedeb3b1a8f3c3c502b799fdd0a720 SHA512 6619177a2ff9934fe8b15d6aa229abb8e34d0b1a75228d9efba9393daf71d6419a7256de57b31e2f9f829f71f842118556f996e86ee076f1e0a7cd394dfd31a2 |
28 |
+DIST clang-800.0.42.1.tar.gz 41165807 BLAKE2B 89e3ddc0268c2302f6679089648163a1b7457c3133f8f07de12c5980a66b6b7efdfa65966f5d9425ca20bd622cb1739bc009fe45edb4f0986ffd36af77a2480e SHA512 7fec6236996e4647043697f0f62d2eddb064a4604a7c64c11d2df2ff89aff95f4eb9fe1c2e604c0e276296927dd06b8a7794e0343bf0352cf65400dde40aab41 |
29 |
+DIST llvm-5.0.1.src.tar.xz 23428720 BLAKE2B 3db4d33df21018d17eef0042c0d8d82a8412bd5daa99cfb5405a6ec83c5774178fa76b220e8731c2a9a64dabf898aa90fe29c685327bd63a4f078e8e94a9a77e SHA512 bee1d45fca15ce725b1f2b1339b13eb6f750a3a321cfd099075477ec25835a8ca55b5366172c4aad46592dfd8afe372349ecf264f581463d017f9cee2d63c1cb |
30 |
DIST tapi-1.30.tar.gz 29071 BLAKE2B e5eb4f2eea6500d4f06c490c8b7f70070fe2ba31579133b92c1d162c33afb3c422c2fba1249734a5749455185a4fc3d79b1eb00820387990cc65fe0fc69ac55a SHA512 fa495da150c6b6ff9e0bf667a9a06f0b932363297b75379fd59a5c728168a3ac103a656d1a59fa1b0c0012a18c9874439237bbf2a3c26f9bdf202b4d78e31520 |
31 |
+DIST tapi-2.0.0.tar.gz 195080 BLAKE2B 28c31f4cb119525edb1a755895d8a3a05c9a606610fbf0c135790c0caf85a26d3b7e7fbbf856d001c26641a755e0d836f2f697a5856153d9dfc7c258e28427a1 SHA512 fc7209556ff75285a99ce64225831d53f9d959f7d6d9562cbfe91b019591860a00196c93de2258bbdaba02301af38990557b7e241ad3f66d09eb9440f4edf5ab |
32 |
|
33 |
diff --git a/sys-libs/tapi/files/objcmetadata-800.0.42.1-standalone.patch b/sys-libs/tapi/files/objcmetadata-800.0.42.1-standalone.patch |
34 |
new file mode 100644 |
35 |
index 00000000000..71ca24f1beb |
36 |
--- /dev/null |
37 |
+++ b/sys-libs/tapi/files/objcmetadata-800.0.42.1-standalone.patch |
38 |
@@ -0,0 +1,130 @@ |
39 |
+Provide standalone cmake project file that allows compilation outside the LLVM |
40 |
+source tree and installs the headers as well. |
41 |
+ |
42 |
+Tune other CMakeLists for out-of-tree build. |
43 |
+ |
44 |
+Provide missing isDynamic() method for Objective C properties. (Best-guess |
45 |
+implementation based on |
46 |
+https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html |
47 |
+and llvm-objdump -m -objc-meta-data output). Does not seem to be used anywhere |
48 |
+anyways - but the control flow of the code is somewhat encrypted. |
49 |
+ |
50 |
+Adjust to some minor API differencies between Apple clang 8.0.0 and upstream |
51 |
+LLVM 5.0.1. |
52 |
+ |
53 |
+--- objcmetadata-800.0.42.1/CMakeLists.txt.orig 2017-12-25 22:23:41.000000000 +0100 |
54 |
++++ objcmetadata-800.0.42.1/CMakeLists.txt 2017-12-25 20:54:39.000000000 +0100 |
55 |
+@@ -0,0 +1,25 @@ |
56 |
++cmake_minimum_required(VERSION 3.4.3) |
57 |
++project(ObjCMetadata) |
58 |
++ |
59 |
++find_package(LLVM REQUIRED CONFIG) |
60 |
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR}) |
61 |
++include(AddLLVM) |
62 |
++ |
63 |
++include_directories(${LLVM_INCLUDE_DIRS}) |
64 |
++link_directories(${LLVM_LIBRARY_DIRS}) |
65 |
++add_definitions(${LLVM_DEFINITIONS}) |
66 |
++set(LLVM_COMMON_LIBS Object Support Analysis Core) |
67 |
++ |
68 |
++include_directories(BEFORE |
69 |
++ ${CMAKE_CURRENT_BINARY_DIR}/include |
70 |
++ ${CMAKE_CURRENT_SOURCE_DIR}/include |
71 |
++ ) |
72 |
++ |
73 |
++install(FILES |
74 |
++ include/llvm/${PROJECT_NAME}/ObjCBitcode.h |
75 |
++ include/llvm/${PROJECT_NAME}/ObjCMachOBinary.h |
76 |
++ include/llvm/${PROJECT_NAME}/ObjCMetadata.h |
77 |
++ DESTINATION include/llvm/${PROJECT_NAME} |
78 |
++ ) |
79 |
++ |
80 |
++add_subdirectory(lib/${PROJECT_NAME}) |
81 |
+--- objcmetadata-800.0.42.1/include/llvm/ObjCMetadata/ObjCMetadata.h.orig 2017-12-25 20:09:28.000000000 +0100 |
82 |
++++ objcmetadata-800.0.42.1/include/llvm/ObjCMetadata/ObjCMetadata.h 2017-12-25 20:10:11.000000000 +0100 |
83 |
+@@ -110,6 +110,7 @@ |
84 |
+ // Return empty string if doesn't exists. |
85 |
+ Expected<std::string> getGetter() const; |
86 |
+ Expected<std::string> getSetter() const; |
87 |
++ Expected<bool> isDynamic() const; |
88 |
+ }; |
89 |
+ |
90 |
+ class ObjCMethod : public ObjCInfoBase { |
91 |
+--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMetadata.cpp.orig 2017-12-25 20:09:11.000000000 +0100 |
92 |
++++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMetadata.cpp 2017-12-25 20:13:33.000000000 +0100 |
93 |
+@@ -164,6 +164,20 @@ |
94 |
+ return setter; |
95 |
+ } |
96 |
+ |
97 |
++Expected<bool> ObjCProperty::isDynamic() const { |
98 |
++ auto Attr = getAttribute(); |
99 |
++ if (!Attr) |
100 |
++ return Attr.takeError(); |
101 |
++ // Find setter attribute. |
102 |
++ SmallVector<StringRef, 4> Attrs; |
103 |
++ Attr->split(Attrs, ','); |
104 |
++ for (auto a : Attrs) { |
105 |
++ if (a == "D") |
106 |
++ return true; |
107 |
++ } |
108 |
++ return false; |
109 |
++} |
110 |
++ |
111 |
+ Expected<StringRef> ObjCMethod::getName() const { |
112 |
+ return MetadataReader->getMethodName(*this); |
113 |
+ } |
114 |
+--- objcmetadata-800.0.42.1/lib/ObjCMetadata/CMakeLists.txt.orig 2017-12-25 17:29:01.000000000 +0100 |
115 |
++++ objcmetadata-800.0.42.1/lib/ObjCMetadata/CMakeLists.txt 2017-12-25 20:59:31.000000000 +0100 |
116 |
+@@ -1,3 +1,10 @@ |
117 |
++set(LLVM_LINK_COMPONENTS |
118 |
++ Object |
119 |
++ Support |
120 |
++ Analysis |
121 |
++ Core |
122 |
++) |
123 |
++ |
124 |
+ add_llvm_library(LLVMObjCMetadata |
125 |
+ ObjCBitcode.cpp |
126 |
+ ObjCMetadata.cpp |
127 |
+@@ -5,7 +12,4 @@ |
128 |
+ |
129 |
+ ADDITIONAL_HEADER_DIRS |
130 |
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/ObjCMetadata |
131 |
+- |
132 |
+- DEPENDS |
133 |
+- intrinsics_gen |
134 |
+ ) |
135 |
+--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCBitcode.cpp.orig 2017-12-25 17:14:29.000000000 +0100 |
136 |
++++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCBitcode.cpp 2017-12-25 17:17:51.000000000 +0100 |
137 |
+@@ -20,7 +20,7 @@ |
138 |
+ #include "llvm/IR/GlobalAlias.h" |
139 |
+ #include "llvm/IR/GlobalVariable.h" |
140 |
+ #include "llvm/IR/Operator.h" |
141 |
+-#include "llvm/Support/Error.h" |
142 |
++#include "llvm/Object/Error.h" |
143 |
+ |
144 |
+ #include "macho-obj.h" |
145 |
+ |
146 |
+@@ -75,7 +75,7 @@ |
147 |
+ Operator::getOpcode(V) == Instruction::AddrSpaceCast) { |
148 |
+ V = cast<Operator>(V)->getOperand(0); |
149 |
+ } else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) { |
150 |
+- if (GA->mayBeOverridden()) |
151 |
++ if (GA->isInterposable()) |
152 |
+ return V; |
153 |
+ V = GA->getAliasee(); |
154 |
+ } else if (PtrToIntOperator *PTI = dyn_cast<PtrToIntOperator>(V)) { |
155 |
+--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMachOBinary.cpp.orig 2017-12-25 17:24:23.000000000 +0100 |
156 |
++++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMachOBinary.cpp 2017-12-25 17:27:15.000000000 +0100 |
157 |
+@@ -1262,9 +1262,9 @@ |
158 |
+ const char *SymbolName = nullptr; |
159 |
+ if (reloc_found && isExtern) { |
160 |
+ offset = Symbol.getValue(); |
161 |
+- ErrorOr<StringRef> NameOrError = Symbol.getName(); |
162 |
++ Expected<StringRef> NameOrError = Symbol.getName(); |
163 |
+ if (!NameOrError) { |
164 |
+- return errorOrToExpected(std::move(NameOrError)); |
165 |
++ return NameOrError; |
166 |
+ } |
167 |
+ StringRef Name = *NameOrError; |
168 |
+ if (!Name.empty()) { |
169 |
|
170 |
diff --git a/sys-libs/tapi/files/tapi-2.0.0-standalone.patch b/sys-libs/tapi/files/tapi-2.0.0-standalone.patch |
171 |
new file mode 100644 |
172 |
index 00000000000..77bc56331df |
173 |
--- /dev/null |
174 |
+++ b/sys-libs/tapi/files/tapi-2.0.0-standalone.patch |
175 |
@@ -0,0 +1,141 @@ |
176 |
+Tune CMakeLists for out-of-tree build. |
177 |
+ |
178 |
+Adjust for API discrepancies between Apple clang-8.0.0 and upstream LLVM 5.0.1. |
179 |
+ |
180 |
+Allow all clients to link against the library, not just ld. Main reason: Our ld |
181 |
+is called ld64 when we link it. |
182 |
+ |
183 |
+--- tapi-2.0.0/tools/tapi/CMakeLists.txt.orig 2017-12-25 22:36:06.620886714 +0100 |
184 |
++++ tapi-2.0.0/tools/tapi/CMakeLists.txt 2017-12-25 22:41:43.867893060 +0100 |
185 |
+@@ -6,6 +6,12 @@ |
186 |
+ |
187 |
+ target_link_libraries(tapi |
188 |
+ tapiDriver |
189 |
++ clangAST |
190 |
++ clangFrontend |
191 |
++ LLVMOption |
192 |
++ LLVMDemangle |
193 |
++ LLVMSupport |
194 |
++ LLVMCore |
195 |
+ ) |
196 |
+ |
197 |
+ if (TAPI_BUILD_LIBIOSSDK) |
198 |
+--- tapi-2.0.0/tools/libtapi/CMakeLists.txt.orig 2017-12-25 22:26:06.816905789 +0100 |
199 |
++++ tapi-2.0.0/tools/libtapi/CMakeLists.txt 2017-12-25 22:31:22.914862289 +0100 |
200 |
+@@ -1,4 +1,7 @@ |
201 |
+ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libtapi.exports) |
202 |
++set(LLVM_LINK_COMPONENTS |
203 |
++ Support |
204 |
++ ) |
205 |
+ |
206 |
+ add_tapi_library(libtapi |
207 |
+ SHARED |
208 |
+@@ -19,5 +22,5 @@ |
209 |
+ |
210 |
+ set_property(TARGET libtapi APPEND_STRING |
211 |
+ PROPERTY |
212 |
+- LINK_FLAGS " -current_version ${TAPI_FULL_VERSION} -compatibility_version 1 -allowable_client ld" |
213 |
++ LINK_FLAGS " -current_version ${TAPI_FULL_VERSION} -compatibility_version 1" |
214 |
+ ) |
215 |
+--- tapi-2.0.0/tools/tapi-run/CMakeLists.txt.orig 2017-12-26 15:12:39.605057352 +0100 |
216 |
++++ tapi-2.0.0/tools/tapi-run/CMakeLists.txt 2017-12-26 15:15:53.304983942 +0100 |
217 |
+@@ -5,6 +5,8 @@ |
218 |
+ target_link_libraries(tapi-run |
219 |
+ tapiCore |
220 |
+ libtapi |
221 |
++ LLVMSupport |
222 |
++ LLVMCore |
223 |
+ ) |
224 |
+ |
225 |
+ set_property(TARGET tapi-run APPEND_STRING |
226 |
+--- tapi-2.0.0/CMakeLists.txt.orig 2017-12-24 15:27:56.000000000 +0100 |
227 |
++++ tapi-2.0.0/CMakeLists.txt 2017-12-26 15:50:01.199506782 +0100 |
228 |
+@@ -4,6 +4,24 @@ |
229 |
+ message(FATAL_ERROR "Unsupported configuration.") |
230 |
+ endif() |
231 |
+ |
232 |
++project(tapi) |
233 |
++set(PACKAGE_VENDOR Apple CACHE STRING "") |
234 |
++add_definitions(-DTAPI_BUG_REPORT_URL="https://bugs.gentoo.org/") |
235 |
++ |
236 |
++find_package(LLVM REQUIRED CONFIG) |
237 |
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR}) |
238 |
++include(AddLLVM) |
239 |
++ |
240 |
++add_definitions(${LLVM_DEFINITIONS}) |
241 |
++include_directories(${LLVM_INCLUDE_DIRS} ${OBJCMETADATA_INCLUDE_DIRS}) |
242 |
++link_directories(${LLVM_LIBRARY_DIRS} ${OBJCMETADATA_LIBRARY_DIRS}) |
243 |
++ |
244 |
++# make tblgen happy |
245 |
++include(TableGen) |
246 |
++foreach(IPATH ${LLVM_INCLUDE_DIRS}) |
247 |
++ list(APPEND LLVM_TABLEGEN_FLAGS -I ${IPATH}) |
248 |
++endforeach(IPATH) |
249 |
++ |
250 |
+ set(TAPI_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
251 |
+ set(TAPI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
252 |
+ |
253 |
+--- tapi-2.0.0/lib/Core/MachODylibReader.cpp.orig 2017-12-24 15:27:56.000000000 +0100 |
254 |
++++ tapi-2.0.0/lib/Core/MachODylibReader.cpp 2017-12-25 22:15:53.075478606 +0100 |
255 |
+@@ -254,8 +254,7 @@ |
256 |
+ auto arch = getArchType(H.cputype, H.cpusubtype); |
257 |
+ assert(arch != Architecture::unknown && "unknown architecture slice"); |
258 |
+ |
259 |
+- Error error = Error::success(); |
260 |
+- for (const auto &symbol : object->exports(error)) { |
261 |
++ for (const auto &symbol : object->exports()) { |
262 |
+ StringRef name; |
263 |
+ XPIKind kind; |
264 |
+ std::tie(name, kind) = parseSymbol(symbol.name()); |
265 |
+@@ -272,7 +271,7 @@ |
266 |
+ file->addSymbol(kind, name, arch, flags); |
267 |
+ } |
268 |
+ |
269 |
+- return error; |
270 |
++ return Error::success(); |
271 |
+ } |
272 |
+ |
273 |
+ static Error readUndefinedSymbols(MachOObjectFile *object, |
274 |
+@@ -309,10 +308,7 @@ |
275 |
+ auto H = object->getHeader(); |
276 |
+ auto arch = getArchType(H.cputype, H.cpusubtype); |
277 |
+ |
278 |
+- auto error = Error::success(); |
279 |
+- MachOMetadata metadata(object, error); |
280 |
+- if (error) |
281 |
+- return std::move(error); |
282 |
++ MachOMetadata metadata(object); |
283 |
+ |
284 |
+ /// |
285 |
+ /// Classes |
286 |
+--- tapi-2.0.0/lib/Driver/Snapshot.cpp.orig 2017-12-24 15:27:56.000000000 +0100 |
287 |
++++ tapi-2.0.0/lib/Driver/Snapshot.cpp 2017-12-26 15:49:09.864184826 +0100 |
288 |
+@@ -14,7 +14,7 @@ |
289 |
+ #include "tapi/Defines.h" |
290 |
+ #include "clang/Frontend/FrontendOptions.h" |
291 |
+ #include "llvm/ADT/ArrayRef.h" |
292 |
+-#include "llvm/Config/config.h" |
293 |
++#include "llvm/Config/llvm-config.h" |
294 |
+ #include "llvm/Support/FileSystem.h" |
295 |
+ #include "llvm/Support/raw_ostream.h" |
296 |
+ #include "llvm/Support/xxhash.h" |
297 |
+@@ -356,7 +356,7 @@ |
298 |
+ } |
299 |
+ |
300 |
+ if (isCrash) { |
301 |
+- outs() << "PLEASE submit a bug report to " BUG_REPORT_URL |
302 |
++ outs() << "PLEASE submit a bug report to " TAPI_BUG_REPORT_URL |
303 |
+ " and include the " |
304 |
+ "crash backtrace and snapshot.\n\n" |
305 |
+ "********************************************************\n\n" |
306 |
+--- tapi-2.0.0/lib/Driver/Options.cpp.orig 2017-12-25 22:17:40.506874748 +0100 |
307 |
++++ tapi-2.0.0/lib/Driver/Options.cpp 2017-12-25 22:18:04.181989766 +0100 |
308 |
+@@ -1023,7 +1023,7 @@ |
309 |
+ table->PrintHelp( |
310 |
+ outs(), |
311 |
+ (programName + " " + getNameFromTAPICommand(command)).str().c_str(), |
312 |
+- toolName, /*FlagsToInclude=*/getIncludeOptionFlagMasks(command), |
313 |
++ toolName, /*FlagsToInclude=*///getIncludeOptionFlagMasks(command), |
314 |
+ /*FlagsToExclude=*/0, /*ShowAllAliases=*/false); |
315 |
+ } |
316 |
+ |
317 |
|
318 |
diff --git a/sys-libs/tapi/tapi-2.0.0.ebuild b/sys-libs/tapi/tapi-2.0.0.ebuild |
319 |
new file mode 100644 |
320 |
index 00000000000..586bd1d95c2 |
321 |
--- /dev/null |
322 |
+++ b/sys-libs/tapi/tapi-2.0.0.ebuild |
323 |
@@ -0,0 +1,177 @@ |
324 |
+# Copyright 1999-2017 Gentoo Foundation |
325 |
+# Distributed under the terms of the GNU General Public License v2 |
326 |
+ |
327 |
+EAPI=6 |
328 |
+ |
329 |
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja} |
330 |
+ |
331 |
+inherit cmake-utils llvm |
332 |
+ |
333 |
+# This is a hog: We need to carve ObjCMetadata out of Apple's clang. We also |
334 |
+# need llvm-tblgen and clang-tblgen because tapi uses them to generate some |
335 |
+# source. It's assumed that they're only ever needed when building LLVM and |
336 |
+# clang. So they don't get installed in the system and we need to compile them |
337 |
+# fresh from LLVM and clang sources. And finally we need an installed LLVM and |
338 |
+# clang to build tapi against. |
339 |
+ |
340 |
+LLVM_PV=5.0.1 |
341 |
+LLVM_PN=llvm |
342 |
+LLVM_P=${LLVM_PN}-${LLVM_PV} |
343 |
+ |
344 |
+CLANG_PN=cfe |
345 |
+CLANG_P=${CLANG_PN}-${LLVM_PV} |
346 |
+ |
347 |
+APPLE_LLVM_PV=800.0.42.1 |
348 |
+APPLE_LLVM_PN=clang |
349 |
+APPLE_LLVM_P=${APPLE_LLVM_PN}-${APPLE_LLVM_PV} |
350 |
+ |
351 |
+OBJCMD_PN=objcmetadata |
352 |
+OBJCMD_P=${OBJCMD_PN}-${APPLE_LLVM_PV} |
353 |
+ |
354 |
+DESCRIPTION="Text-based Application Programming Interface" |
355 |
+HOMEPAGE="https://opensource.apple.com/source/tapi" |
356 |
+SRC_URI="https://opensource.apple.com/tarballs/clang/${APPLE_LLVM_P}.tar.gz |
357 |
+ http://releases.llvm.org/${LLVM_PV}/${LLVM_P}.src.tar.xz |
358 |
+ http://releases.llvm.org/${LLVM_PV}/${CLANG_P}.src.tar.xz" |
359 |
+ |
360 |
+if [[ ${PV} == 9999* ]] ; then |
361 |
+ EGIT_REPO_URI="https://github.com/ributzka/tapi.git" |
362 |
+ TAPI_P=${P} |
363 |
+ inherit git-r3 |
364 |
+else |
365 |
+ TAPI_COMMIT=b9205695b4edee91000383695be8de5ba8e0db41 |
366 |
+ SRC_URI+=" https://github.com/ributzka/${PN}/archive/${TAPI_COMMIT}.tar.gz -> ${P}.tar.gz" |
367 |
+ TAPI_P=${PN}-${TAPI_COMMIT} |
368 |
+fi |
369 |
+ |
370 |
+LICENSE="|| ( UoI-NCSA MIT )" |
371 |
+SLOT="0" |
372 |
+KEYWORDS="~x64-macos ~x86-macos" |
373 |
+ |
374 |
+DEPEND="sys-devel/llvm:= |
375 |
+ sys-devel/clang:=" |
376 |
+RDEPEND="${DEPEND}" |
377 |
+ |
378 |
+DOCS=( Readme.md ) |
379 |
+ |
380 |
+LLVM_S="${WORKDIR}"/${LLVM_P}.src |
381 |
+LLVM_BUILD="${WORKDIR}"/${LLVM_P}_build |
382 |
+ |
383 |
+CLANG_S="${WORKDIR}"/${CLANG_P}.src |
384 |
+ |
385 |
+APPLE_LLVM_S="${WORKDIR}/${APPLE_LLVM_P}"/src |
386 |
+ |
387 |
+TAPI_S="${WORKDIR}"/${TAPI_P} |
388 |
+ |
389 |
+# to avoid ebuild dying |
390 |
+S=${WORKDIR} |
391 |
+ |
392 |
+TAPI_BUILD="${WORKDIR}"/${P}_build |
393 |
+ |
394 |
+OBJCMD_S="${WORKDIR}"/${OBJCMD_P} |
395 |
+OBJCMD_BUILD="${WORKDIR}"/${OBJCMD_P}_build |
396 |
+# put temporary install root into tapi build dir so that it does not end up on |
397 |
+# libtapi's rpath |
398 |
+OBJCMD_ROOT="${TAPI_BUILD}"/${OBJCMD_PN}_root |
399 |
+ |
400 |
+src_prepare() { |
401 |
+ # carve ObjCMetadata out of llvm and make it stand on its own |
402 |
+ mkdir -p "${OBJCMD_S}"/{include/llvm,lib} || die |
403 |
+ cd ${OBJCMD_S} || die |
404 |
+ cp -r ${APPLE_LLVM_S}/include/llvm/ObjCMetadata include/llvm || die |
405 |
+ cp -r ${APPLE_LLVM_S}/lib/ObjCMetadata lib || die |
406 |
+ eapply "${FILESDIR}"/${OBJCMD_PN}-800.0.42.1-standalone.patch |
407 |
+ CMAKE_USE_DIR="${PWD}" \ |
408 |
+ cmake-utils_src_prepare |
409 |
+ |
410 |
+ cd "${LLVM_S}" || die |
411 |
+ CMAKE_USE_DIR="${PWD}" \ |
412 |
+ cmake-utils_src_prepare |
413 |
+ |
414 |
+ cd "${TAPI_S}" || die |
415 |
+ eapply "${FILESDIR}"/${PN}-2.0.0-standalone.patch |
416 |
+ CMAKE_USE_DIR="${PWD}" \ |
417 |
+ cmake-utils_src_prepare |
418 |
+} |
419 |
+ |
420 |
+src_configure() { |
421 |
+ # configure LLVM and clang for tablegen build |
422 |
+ local mycmakeargs=( |
423 |
+ # shared libs cause all kinds of problems and we don't need them just |
424 |
+ # to run tblgen a couple of times |
425 |
+ -DBUILD_SHARED_LIBS=OFF |
426 |
+ # configure less targets to speed up configuration. We don't build them |
427 |
+ # anyway. |
428 |
+ -DLLVM_TARGETS_TO_BUILD=X86 |
429 |
+ -DLLVM_EXTERNAL_PROJECTS=clang |
430 |
+ -DLLVM_EXTERNAL_CLANG_SOURCE_DIR=${CLANG_S} |
431 |
+ ) |
432 |
+ |
433 |
+ cd "${LLVM_S}" || die |
434 |
+ BUILD_DIR="${LLVM_BUILD}" \ |
435 |
+ CMAKE_USE_DIR="${PWD}" \ |
436 |
+ CMAKE_BUILD_TYPE=RelWithDebInfo \ |
437 |
+ cmake-utils_src_configure |
438 |
+ |
439 |
+ local llvm_prefix=$(get_llvm_prefix) |
440 |
+ |
441 |
+ # configure ObjCMetadata |
442 |
+ local mycmakeargs=( |
443 |
+ # fails to compile without -std=c++11 |
444 |
+ -DCMAKE_CXX_STANDARD=11 |
445 |
+ # compile against currently installed LLVM |
446 |
+ -DLLVM_DIR="${llvm_prefix}/lib/cmake/llvm" |
447 |
+ # install into temporary root in work dir just so we can compile and |
448 |
+ # link against it. Static lib will be pulled into libtapi and tools. |
449 |
+ -DCMAKE_INSTALL_PREFIX="${OBJCMD_ROOT}" |
450 |
+ ) |
451 |
+ |
452 |
+ cd "${OBJCMD_S}" || die |
453 |
+ BUILD_DIR="${OBJCMD_BUILD}" \ |
454 |
+ CMAKE_USE_DIR="${PWD}" \ |
455 |
+ cmake-utils_src_configure |
456 |
+ |
457 |
+ # configure tapi |
458 |
+ local mycmakeargs=( |
459 |
+ # fails to compile without -std=c++11 |
460 |
+ -DCMAKE_CXX_STANDARD=11 |
461 |
+ # compile against currently installed LLVM |
462 |
+ -DLLVM_DIR="${llvm_prefix}"/lib/cmake/llvm |
463 |
+ # use tblgens from LLVM build directory directly. They generate source |
464 |
+ # from description files. Therefore it shouldn't matter if they |
465 |
+ # match up with the installed LLVM. |
466 |
+ -DLLVM_TABLEGEN_EXE="${LLVM_BUILD}"/bin/llvm-tblgen |
467 |
+ -DCLANG_TABLEGEN_EXE="${LLVM_BUILD}"/bin/clang-tblgen |
468 |
+ # pull in includes and libs from ObjCMetadata's temporary install root |
469 |
+ -DOBJCMETADATA_INCLUDE_DIRS="${OBJCMD_ROOT}"/include |
470 |
+ -DOBJCMETADATA_LIBRARY_DIRS="${OBJCMD_ROOT}"/lib |
471 |
+ ) |
472 |
+ |
473 |
+ cd "${TAPI_S}" || die |
474 |
+ BUILD_DIR="${TAPI_BUILD}/" \ |
475 |
+ CMAKE_USE_DIR="${PWD}" \ |
476 |
+ cmake-utils_src_configure |
477 |
+} |
478 |
+ |
479 |
+src_compile() { |
480 |
+ # build LLVM and clang tablegen |
481 |
+ cd "${LLVM_S}" || die |
482 |
+ BUILD_DIR="${LLVM_BUILD}" \ |
483 |
+ CMAKE_USE_DIR="${PWD}" \ |
484 |
+ cmake-utils_src_compile llvm-tblgen clang-tblgen |
485 |
+ |
486 |
+ # build ObjCMetadata |
487 |
+ cd "${OBJCMD_S}" || die |
488 |
+ BUILD_DIR="${OBJCMD_BUILD}" \ |
489 |
+ CMAKE_USE_DIR="${PWD}" \ |
490 |
+ cmake-utils_src_compile |
491 |
+ # install into temporary root in work dir |
492 |
+ cd "${OBJCMD_BUILD}" || die |
493 |
+ ${CMAKE_MAKEFILE_GENERATOR} install |
494 |
+ |
495 |
+ # finally build tapi |
496 |
+ cd "${TAPI_S}" || die |
497 |
+ BUILD_DIR="${TAPI_BUILD}" \ |
498 |
+ CMAKE_USE_DIR="${PWD}" \ |
499 |
+ cmake-utils_src_compile |
500 |
+} |