1 |
commit: b417a117e7fcb6e0d830a6d1d120525bac094c63 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 30 16:26:41 2023 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 30 20:32:54 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b417a117 |
7 |
|
8 |
sys-devel/clang: Add 16.0.0_rc1 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
sys-devel/clang/Manifest | 2 + |
13 |
sys-devel/clang/clang-16.0.0_rc1.ebuild | 472 ++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 474 insertions(+) |
15 |
|
16 |
diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest |
17 |
index d36dfbea9dcc..56210b031d68 100644 |
18 |
--- a/sys-devel/clang/Manifest |
19 |
+++ b/sys-devel/clang/Manifest |
20 |
@@ -8,6 +8,8 @@ DIST llvm-project-14.0.6.src.tar.xz 105618228 BLAKE2B ee67c5407df8cef493b9c0004f |
21 |
DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B cb658ad43d8ab6c43a5773aedadf0569c97b5ee4b1bd58eceb10e1879a30880c741c3d66bedd462c892309b688fb7b2673115a62d1f74d71ee375a578de9547f SHA512 b4a7b368532a7a4a24376cfa7db8f6d3478f6d4446474342fc00b474ecf466330cd0f16783209263c4c72d5fc7ddedfb11b95578842e700cfb7ee0bb34cc95d6 |
22 |
DIST llvm-project-15.0.7.src.tar.xz 110936452 BLAKE2B f3d277e2029157329e5be78b78af36b0826a1dfd9a337992499bf701e33149665bfc47d5e14978e38f342559629a559f8b2ce328705ba34fdf6830f5ae9721a5 SHA512 4836d3603f32e8e54434cbfa8ef33d9d473ac5dc20ebf9c67132653c73f4524931abd1084655eaee5f20bcfcb91bcc4bbc5c4a0b603ad0c9029c556e14dc4c52 |
23 |
DIST llvm-project-15.0.7.src.tar.xz.sig 566 BLAKE2B 47dc8c82d86237b80c6d85f83a6c9a6e9e174cf8e7f367b071e0cd9481d7cd408e991337c5624e07f3f370f26387c814f212808575ed1c1b58404d3e3836b7df SHA512 fc6891b440dd1175eb8df3790590af8d36bc92301660f84744ae15123475aeb900a151e6a8e7998ded27ec4d86871903ad0b89cd61164943054c2e3bc8d8beb2 |
24 |
+DIST llvm-project-16.0.0rc1.src.tar.xz 118364920 BLAKE2B 449fa321722e77d1a595d0f1f52a4e9492954d928355402f6e07e6c8a20e4ebfc03690ef8272b92eb5cdd58c97ca37fa6baf847d399e36a84e3ea7d94d1ea6ca SHA512 a24074ea8e21af49b0545f02bdec4727e8df841e59340dc189cc5a144a70fc6880e82381fba622ac62c7504f7bf394c916c773ee25904e8faf41eaedce6ae9e0 |
25 |
+DIST llvm-project-16.0.0rc1.src.tar.xz.sig 566 BLAKE2B 29a593f74b05ef6268f0b2ee5ebd810a244e7c6b27dd94f709b22bca8e6c8367f8321a6ec61f85476cd399f31519ac2a3c978014afae29490c1e70d26eb6c35f SHA512 dcca03d41ee3cc7d5b150184b03eb9f2e579603ce9cd5289360d1ca47169174afc26a85079cf096ec91e23f487f0b38bb6cd5fb7e5197530582155b16a5ce748 |
26 |
DIST llvm-project-46d5a57801bc37e5ebb1a4d6b2acc0fa99c01e8d.tar.gz 180436731 BLAKE2B 51c30c3f11dd55a225b8ebe4ded752ce9e8eb58751e7458c29901dbdd3673f94892d337d111d696e779e3f7ef0bca6c7d79709e2072a4bf3a001d8813125d571 SHA512 ebbe0f8becac39d63433dcc3de474c40f1215fc8faab94fa2ba869d28e66b27e4fe088377bd7ae64575a6d7b07017b88bf92e5488a3185a753e647d8da352bbf |
27 |
DIST llvm-project-6dc85bd3fde7df2999fda07e9e9f2e83d52c6125.tar.gz 175208511 BLAKE2B cf87cf7e9bf7c74aab8ccda0f153369cb81798047fdd48025c3c7030857b128babbaafb667385a5c8e9916e16038b14fee39f1623d329471e73c39c2f2d7bbfa SHA512 e6dc0cacd6c079be8a00364e4c244782d764d9a8d514d65f9078427cb4a0c1663ff88761bfbc1e955a1a990451439110497c2cb7af7f56b2c91f2e9db4389894 |
28 |
DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f |
29 |
|
30 |
diff --git a/sys-devel/clang/clang-16.0.0_rc1.ebuild b/sys-devel/clang/clang-16.0.0_rc1.ebuild |
31 |
new file mode 100644 |
32 |
index 000000000000..b45257440e78 |
33 |
--- /dev/null |
34 |
+++ b/sys-devel/clang/clang-16.0.0_rc1.ebuild |
35 |
@@ -0,0 +1,472 @@ |
36 |
+# Copyright 1999-2023 Gentoo Authors |
37 |
+# Distributed under the terms of the GNU General Public License v2 |
38 |
+ |
39 |
+EAPI=8 |
40 |
+ |
41 |
+PYTHON_COMPAT=( python3_{9..11} ) |
42 |
+inherit cmake llvm llvm.org multilib multilib-minimal \ |
43 |
+ prefix python-single-r1 toolchain-funcs |
44 |
+ |
45 |
+DESCRIPTION="C language family frontend for LLVM" |
46 |
+HOMEPAGE="https://llvm.org/" |
47 |
+ |
48 |
+# MSVCSetupApi.h: MIT |
49 |
+# sorttable.js: MIT |
50 |
+ |
51 |
+LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" |
52 |
+SLOT="${LLVM_MAJOR}/${LLVM_SOABI}" |
53 |
+KEYWORDS="" |
54 |
+IUSE="debug doc +extra ieee-long-double +pie +static-analyzer test xml" |
55 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
56 |
+RESTRICT="!test? ( test )" |
57 |
+ |
58 |
+DEPEND=" |
59 |
+ ~sys-devel/llvm-${PV}:${LLVM_MAJOR}=[debug=,${MULTILIB_USEDEP}] |
60 |
+ static-analyzer? ( dev-lang/perl:* ) |
61 |
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) |
62 |
+" |
63 |
+ |
64 |
+RDEPEND=" |
65 |
+ ${PYTHON_DEPS} |
66 |
+ ${DEPEND} |
67 |
+ >=sys-devel/clang-common-${PV} |
68 |
+" |
69 |
+BDEPEND=" |
70 |
+ ${PYTHON_DEPS} |
71 |
+ >=dev-util/cmake-3.16 |
72 |
+ doc? ( $(python_gen_cond_dep ' |
73 |
+ dev-python/recommonmark[${PYTHON_USEDEP}] |
74 |
+ dev-python/sphinx[${PYTHON_USEDEP}] |
75 |
+ ') ) |
76 |
+ xml? ( virtual/pkgconfig ) |
77 |
+" |
78 |
+PDEPEND=" |
79 |
+ ~sys-devel/clang-runtime-${PV} |
80 |
+ sys-devel/clang-toolchain-symlinks:${LLVM_MAJOR} |
81 |
+" |
82 |
+ |
83 |
+LLVM_COMPONENTS=( |
84 |
+ clang clang-tools-extra cmake |
85 |
+ llvm/lib/Transforms/Hello |
86 |
+) |
87 |
+LLVM_MANPAGES=1 |
88 |
+LLVM_TEST_COMPONENTS=( |
89 |
+ llvm/lib/Testing |
90 |
+ llvm/utils |
91 |
+ third-party |
92 |
+) |
93 |
+LLVM_USE_TARGETS=llvm |
94 |
+llvm.org_set_globals |
95 |
+ |
96 |
+# Multilib notes: |
97 |
+# 1. ABI_* flags control ABIs libclang* is built for only. |
98 |
+# 2. clang is always capable of compiling code for all ABIs for enabled |
99 |
+# target. However, you will need appropriate crt* files (installed |
100 |
+# e.g. by sys-devel/gcc and sys-libs/glibc). |
101 |
+# 3. ${CHOST}-clang wrappers are always installed for all ABIs included |
102 |
+# in the current profile (i.e. alike supported by sys-devel/gcc). |
103 |
+# |
104 |
+# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need |
105 |
+# multilib clang* libraries (not runtime, not wrappers). |
106 |
+ |
107 |
+pkg_setup() { |
108 |
+ LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup |
109 |
+ python-single-r1_pkg_setup |
110 |
+} |
111 |
+ |
112 |
+src_prepare() { |
113 |
+ # create extra parent dir for relative CLANG_RESOURCE_DIR access |
114 |
+ mkdir -p x/y || die |
115 |
+ BUILD_DIR=${WORKDIR}/x/y/clang |
116 |
+ |
117 |
+ llvm.org_src_prepare |
118 |
+ |
119 |
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) |
120 |
+ eprefixify \ |
121 |
+ lib/Lex/InitHeaderSearch.cpp \ |
122 |
+ lib/Driver/ToolChains/Darwin.cpp || die |
123 |
+ |
124 |
+ if ! use prefix-guest && [[ -n ${EPREFIX} ]]; then |
125 |
+ sed -i "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" lib/Driver/ToolChains/Linux.cpp || die |
126 |
+ fi |
127 |
+} |
128 |
+ |
129 |
+check_distribution_components() { |
130 |
+ if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then |
131 |
+ local all_targets=() my_targets=() l |
132 |
+ cd "${BUILD_DIR}" || die |
133 |
+ |
134 |
+ while read -r l; do |
135 |
+ if [[ ${l} == install-*-stripped:* ]]; then |
136 |
+ l=${l#install-} |
137 |
+ l=${l%%-stripped*} |
138 |
+ |
139 |
+ case ${l} in |
140 |
+ # meta-targets |
141 |
+ clang-libraries|distribution) |
142 |
+ continue |
143 |
+ ;; |
144 |
+ # tools |
145 |
+ clang|clangd|clang-*) |
146 |
+ ;; |
147 |
+ # static libraries |
148 |
+ clang*|findAllSymbols) |
149 |
+ continue |
150 |
+ ;; |
151 |
+ # conditional to USE=doc |
152 |
+ docs-clang-html|docs-clang-tools-html) |
153 |
+ use doc || continue |
154 |
+ ;; |
155 |
+ esac |
156 |
+ |
157 |
+ all_targets+=( "${l}" ) |
158 |
+ fi |
159 |
+ done < <(${NINJA} -t targets all) |
160 |
+ |
161 |
+ while read -r l; do |
162 |
+ my_targets+=( "${l}" ) |
163 |
+ done < <(get_distribution_components $"\n") |
164 |
+ |
165 |
+ local add=() remove=() |
166 |
+ for l in "${all_targets[@]}"; do |
167 |
+ if ! has "${l}" "${my_targets[@]}"; then |
168 |
+ add+=( "${l}" ) |
169 |
+ fi |
170 |
+ done |
171 |
+ for l in "${my_targets[@]}"; do |
172 |
+ if ! has "${l}" "${all_targets[@]}"; then |
173 |
+ remove+=( "${l}" ) |
174 |
+ fi |
175 |
+ done |
176 |
+ |
177 |
+ if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then |
178 |
+ eqawarn "get_distribution_components() is outdated!" |
179 |
+ eqawarn " Add: ${add[*]}" |
180 |
+ eqawarn "Remove: ${remove[*]}" |
181 |
+ fi |
182 |
+ cd - >/dev/null || die |
183 |
+ fi |
184 |
+} |
185 |
+ |
186 |
+get_distribution_components() { |
187 |
+ local sep=${1-;} |
188 |
+ |
189 |
+ local out=( |
190 |
+ # common stuff |
191 |
+ clang-cmake-exports |
192 |
+ clang-headers |
193 |
+ clang-resource-headers |
194 |
+ libclang-headers |
195 |
+ |
196 |
+ aarch64-resource-headers |
197 |
+ arm-common-resource-headers |
198 |
+ arm-resource-headers |
199 |
+ core-resource-headers |
200 |
+ cuda-resource-headers |
201 |
+ hexagon-resource-headers |
202 |
+ hip-resource-headers |
203 |
+ hlsl-resource-headers |
204 |
+ mips-resource-headers |
205 |
+ opencl-resource-headers |
206 |
+ openmp-resource-headers |
207 |
+ ppc-htm-resource-headers |
208 |
+ ppc-resource-headers |
209 |
+ riscv-resource-headers |
210 |
+ systemz-resource-headers |
211 |
+ utility-resource-headers |
212 |
+ ve-resource-headers |
213 |
+ webassembly-resource-headers |
214 |
+ windows-resource-headers |
215 |
+ x86-resource-headers |
216 |
+ |
217 |
+ # libs |
218 |
+ clang-cpp |
219 |
+ libclang |
220 |
+ ) |
221 |
+ |
222 |
+ if multilib_is_native_abi; then |
223 |
+ out+=( |
224 |
+ # common stuff |
225 |
+ bash-autocomplete |
226 |
+ libclang-python-bindings |
227 |
+ |
228 |
+ # tools |
229 |
+ amdgpu-arch |
230 |
+ c-index-test |
231 |
+ clang |
232 |
+ clang-format |
233 |
+ clang-offload-bundler |
234 |
+ clang-offload-packager |
235 |
+ clang-refactor |
236 |
+ clang-repl |
237 |
+ clang-rename |
238 |
+ clang-scan-deps |
239 |
+ diagtool |
240 |
+ hmaptool |
241 |
+ nvptx-arch |
242 |
+ |
243 |
+ # needed for cross-compiling Clang |
244 |
+ clang-tblgen |
245 |
+ ) |
246 |
+ |
247 |
+ if use extra; then |
248 |
+ out+=( |
249 |
+ # extra tools |
250 |
+ clang-apply-replacements |
251 |
+ clang-change-namespace |
252 |
+ clang-doc |
253 |
+ clang-include-cleaner |
254 |
+ clang-include-fixer |
255 |
+ clang-move |
256 |
+ clang-pseudo |
257 |
+ clang-query |
258 |
+ clang-reorder-fields |
259 |
+ clang-tidy |
260 |
+ clang-tidy-headers |
261 |
+ clangd |
262 |
+ find-all-symbols |
263 |
+ modularize |
264 |
+ pp-trace |
265 |
+ ) |
266 |
+ fi |
267 |
+ |
268 |
+ if llvm_are_manpages_built; then |
269 |
+ out+=( docs-clang-man ) |
270 |
+ use extra && out+=( docs-clang-tools-man ) |
271 |
+ fi |
272 |
+ |
273 |
+ if use doc; then |
274 |
+ out+=( docs-clang-html ) |
275 |
+ use extra && out+=( docs-clang-tools-html ) |
276 |
+ fi |
277 |
+ |
278 |
+ use static-analyzer && out+=( |
279 |
+ clang-check |
280 |
+ clang-extdef-mapping |
281 |
+ scan-build |
282 |
+ scan-build-py |
283 |
+ scan-view |
284 |
+ ) |
285 |
+ fi |
286 |
+ |
287 |
+ printf "%s${sep}" "${out[@]}" |
288 |
+} |
289 |
+ |
290 |
+multilib_src_configure() { |
291 |
+ local mycmakeargs=( |
292 |
+ -DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}") |
293 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}" |
294 |
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man" |
295 |
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang" |
296 |
+ # relative to bindir |
297 |
+ -DCLANG_RESOURCE_DIR="../../../../lib/clang/${LLVM_MAJOR}" |
298 |
+ |
299 |
+ -DBUILD_SHARED_LIBS=OFF |
300 |
+ -DCLANG_LINK_CLANG_DYLIB=ON |
301 |
+ -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) |
302 |
+ -DCLANG_INCLUDE_TESTS=$(usex test) |
303 |
+ |
304 |
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
305 |
+ |
306 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) |
307 |
+ # libgomp support fails to find headers without explicit -I |
308 |
+ # furthermore, it provides only syntax checking |
309 |
+ -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp |
310 |
+ |
311 |
+ # disable using CUDA to autodetect GPU, just build for all |
312 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON |
313 |
+ |
314 |
+ -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) |
315 |
+ |
316 |
+ -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) |
317 |
+ -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) |
318 |
+ |
319 |
+ -DPython3_EXECUTABLE="${PYTHON}" |
320 |
+ ) |
321 |
+ |
322 |
+ if ! use elibc_musl; then |
323 |
+ mycmakeargs+=( |
324 |
+ -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=$(usex ieee-long-double) |
325 |
+ ) |
326 |
+ fi |
327 |
+ |
328 |
+ use test && mycmakeargs+=( |
329 |
+ -DLLVM_BUILD_TESTS=ON |
330 |
+ -DLLVM_LIT_ARGS="$(get_lit_flags)" |
331 |
+ ) |
332 |
+ |
333 |
+ if multilib_is_native_abi; then |
334 |
+ local build_docs=OFF |
335 |
+ if llvm_are_manpages_built; then |
336 |
+ build_docs=ON |
337 |
+ mycmakeargs+=( |
338 |
+ -DLLVM_BUILD_DOCS=ON |
339 |
+ -DLLVM_ENABLE_SPHINX=ON |
340 |
+ -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" |
341 |
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF |
342 |
+ ) |
343 |
+ if use extra; then |
344 |
+ mycmakeargs+=( |
345 |
+ -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" |
346 |
+ ) |
347 |
+ fi |
348 |
+ fi |
349 |
+ mycmakeargs+=( |
350 |
+ -DCLANG_INCLUDE_DOCS=${build_docs} |
351 |
+ ) |
352 |
+ fi |
353 |
+ if multilib_native_use extra; then |
354 |
+ mycmakeargs+=( |
355 |
+ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra |
356 |
+ -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} |
357 |
+ ) |
358 |
+ else |
359 |
+ mycmakeargs+=( |
360 |
+ -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF |
361 |
+ ) |
362 |
+ fi |
363 |
+ |
364 |
+ if [[ -n ${EPREFIX} ]]; then |
365 |
+ mycmakeargs+=( |
366 |
+ -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" |
367 |
+ ) |
368 |
+ fi |
369 |
+ |
370 |
+ if tc-is-cross-compiler; then |
371 |
+ has_version -b sys-devel/clang:${LLVM_MAJOR} || |
372 |
+ die "sys-devel/clang:${LLVM_MAJOR} is required on the build host." |
373 |
+ local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin |
374 |
+ mycmakeargs+=( |
375 |
+ -DLLVM_TOOLS_BINARY_DIR="${tools_bin}" |
376 |
+ -DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen |
377 |
+ ) |
378 |
+ fi |
379 |
+ |
380 |
+ # LLVM can have very high memory consumption while linking, |
381 |
+ # exhausting the limit on 32-bit linker executable |
382 |
+ use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" |
383 |
+ |
384 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
385 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
386 |
+ cmake_src_configure |
387 |
+ |
388 |
+ multilib_is_native_abi && check_distribution_components |
389 |
+} |
390 |
+ |
391 |
+multilib_src_compile() { |
392 |
+ cmake_build distribution |
393 |
+ |
394 |
+ # provide a symlink for tests |
395 |
+ if [[ ! -L ${WORKDIR}/lib/clang ]]; then |
396 |
+ mkdir -p "${WORKDIR}"/lib || die |
397 |
+ ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die |
398 |
+ fi |
399 |
+} |
400 |
+ |
401 |
+multilib_src_test() { |
402 |
+ # respect TMPDIR! |
403 |
+ local -x LIT_PRESERVES_TMP=1 |
404 |
+ local test_targets=( check-clang ) |
405 |
+ if multilib_native_use extra; then |
406 |
+ test_targets+=( |
407 |
+ check-clang-tools |
408 |
+ check-clangd |
409 |
+ ) |
410 |
+ fi |
411 |
+ cmake_build "${test_targets[@]}" |
412 |
+} |
413 |
+ |
414 |
+src_install() { |
415 |
+ MULTILIB_WRAPPED_HEADERS=( |
416 |
+ /usr/include/clang/Config/config.h |
417 |
+ ) |
418 |
+ |
419 |
+ multilib-minimal_src_install |
420 |
+ |
421 |
+ # Move runtime headers to /usr/lib/clang, where they belong |
422 |
+ mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die |
423 |
+ # move (remaining) wrapped headers back |
424 |
+ if use extra; then |
425 |
+ mv "${T}"/clang-tidy "${ED}"/usr/include/ || die |
426 |
+ fi |
427 |
+ mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include || die |
428 |
+ |
429 |
+ # Apply CHOST and version suffix to clang tools |
430 |
+ local clang_tools=( clang clang++ clang-cl clang-cpp ) |
431 |
+ local abi i |
432 |
+ |
433 |
+ # cmake gives us: |
434 |
+ # - clang-X |
435 |
+ # - clang -> clang-X |
436 |
+ # - clang++, clang-cl, clang-cpp -> clang |
437 |
+ # we want to have: |
438 |
+ # - clang-X |
439 |
+ # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X |
440 |
+ # - clang, clang++, clang-cl, clang-cpp -> clang*-X |
441 |
+ # also in CHOST variant |
442 |
+ for i in "${clang_tools[@]:1}"; do |
443 |
+ rm "${ED}/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}" || die |
444 |
+ dosym "clang-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}-${LLVM_MAJOR}" |
445 |
+ dosym "${i}-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}" |
446 |
+ done |
447 |
+ |
448 |
+ # now create target symlinks for all supported ABIs |
449 |
+ for abi in $(get_all_abis); do |
450 |
+ local abi_chost=$(get_abi_CHOST "${abi}") |
451 |
+ for i in "${clang_tools[@]}"; do |
452 |
+ dosym "${i}-${LLVM_MAJOR}" \ |
453 |
+ "/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}-${LLVM_MAJOR}" |
454 |
+ dosym "${abi_chost}-${i}-${LLVM_MAJOR}" \ |
455 |
+ "/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}" |
456 |
+ done |
457 |
+ done |
458 |
+} |
459 |
+ |
460 |
+multilib_src_install() { |
461 |
+ DESTDIR=${D} cmake_build install-distribution |
462 |
+ |
463 |
+ # move headers to /usr/include for wrapping & ABI mismatch checks |
464 |
+ # (also drop the version suffix from runtime headers) |
465 |
+ rm -rf "${ED}"/usr/include || die |
466 |
+ mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include "${ED}"/usr/include || die |
467 |
+ mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die |
468 |
+ if multilib_native_use extra; then |
469 |
+ # don't wrap clang-tidy headers, the list is too long |
470 |
+ # (they're fine for non-native ABI but enabling the targets is problematic) |
471 |
+ mv "${ED}"/usr/include/clang-tidy "${T}/" || die |
472 |
+ fi |
473 |
+} |
474 |
+ |
475 |
+multilib_src_install_all() { |
476 |
+ python_fix_shebang "${ED}" |
477 |
+ if use static-analyzer; then |
478 |
+ python_optimize "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/share/scan-view |
479 |
+ fi |
480 |
+ |
481 |
+ docompress "/usr/lib/llvm/${LLVM_MAJOR}/share/man" |
482 |
+ llvm_install_manpages |
483 |
+ # match 'html' non-compression |
484 |
+ use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" |
485 |
+ # +x for some reason; TODO: investigate |
486 |
+ use static-analyzer && fperms a-x "/usr/lib/llvm/${LLVM_MAJOR}/share/man/man1/scan-build.1" |
487 |
+} |
488 |
+ |
489 |
+pkg_postinst() { |
490 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
491 |
+ eselect compiler-shadow update all |
492 |
+ fi |
493 |
+ |
494 |
+ elog "You can find additional utility scripts in:" |
495 |
+ elog " ${EROOT}/usr/lib/llvm/${LLVM_MAJOR}/share/clang" |
496 |
+ if use extra; then |
497 |
+ elog "Some of them are vim integration scripts (with instructions inside)." |
498 |
+ elog "The run-clang-tidy.py script requires the following additional package:" |
499 |
+ elog " dev-python/pyyaml" |
500 |
+ fi |
501 |
+} |
502 |
+ |
503 |
+pkg_postrm() { |
504 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
505 |
+ eselect compiler-shadow clean all |
506 |
+ fi |
507 |
+} |