1 |
commit: 5f16b1b74d1f1e119ddc71ed09933520942b7051 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Mar 18 07:39:09 2023 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Mar 18 15:03:05 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f16b1b7 |
7 |
|
8 |
sys-devel/clang: Bump to 16.0.0 |
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.ebuild | 481 ++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 483 insertions(+) |
15 |
|
16 |
diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest |
17 |
index 57f9030d8675..b2aaa8aa7b4e 100644 |
18 |
--- a/sys-devel/clang/Manifest |
19 |
+++ b/sys-devel/clang/Manifest |
20 |
@@ -6,6 +6,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.0.src.tar.xz 117933476 BLAKE2B fa09cd8f647ce0daf5a7eae9ac03b99594a9b3193b12065f43f9a6731875243f2f5b354136bcadcb31622b246054e94f880eec3dab0bcd6ae89973fa9dca845c SHA512 3f040abc1b03205693824aeff2ee6efb0cff25fe04bd5265141c093f294655a1f3fcda73cab9c57cbed7523c8f186a7e2484afce0792c55e90e3fb80450fabb7 |
25 |
+DIST llvm-project-16.0.0.src.tar.xz.sig 566 BLAKE2B daba130aa5662fbf7cc2e7aa8fa6b64f9cb355a72330f7a01a21b86389c6f2f85ae93de19ff08ba3f1cfe2834d9a2b7648bdf659caba3afdb2a0d13984774a54 SHA512 38e2449dce20cfbf813d1a9a68b36807722ac8ebb5ee07360fa215b2de8534d2329d3e41cfc3ed33e59e36714b94a6683a6d8077950bcf0037973492e0820fb3 |
26 |
DIST llvm-project-16.0.0rc3.src.tar.xz 117914548 BLAKE2B 18ffa35eb73c7cc4626d7b6b7b30aade7171ee2e17fb8d72e79a67185e809f611fefa4cfef17e5cd16822a5a70de2222534dc9f146fc53987eb49ff6a9d98c18 SHA512 d14e5e5ec984a0dc0292a2d27440398b3e32f120c1579517054dcb1a05dbc4ac5f1c6d078a3d6ef8597a71af6f22863868680a972a571839dcd573418b4a4697 |
27 |
DIST llvm-project-16.0.0rc3.src.tar.xz.sig 566 BLAKE2B 43683d2d7b266a847516f71412bf6236a355462430330fc0da1d624fb8dfbc98bfc982d367baee74d5b4964a9e82e7a4a6ea84bdcff3996d246932f516cced1a SHA512 61adc4dc3eb5a4c11a7f96f9267ff37895e5845a08d48a609a03a2696c1b6bca5af5861a6f28de936c48e6d621bf282170589187f2cb593a912b9078300cf47c |
28 |
DIST llvm-project-16.0.0rc4.src.tar.xz 117930024 BLAKE2B 55cf032ad3ba52d2af0942fe1c627319ae95b466122d04b24a917c33e29139fae546d92c375715600190c02426b798803ead0ab7a97d86960cf98fca80e8815c SHA512 8d628205c5b93fe6683b67b97b5c7f98bae945bd87cccebcdac00ddd4362108bd171f077a5196242be0fb909c795592b34bfa1c96c50a744fb68f287fd9781cc |
29 |
|
30 |
diff --git a/sys-devel/clang/clang-16.0.0.ebuild b/sys-devel/clang/clang-16.0.0.ebuild |
31 |
new file mode 100644 |
32 |
index 000000000000..d2e8178b4e17 |
33 |
--- /dev/null |
34 |
+++ b/sys-devel/clang/clang-16.0.0.ebuild |
35 |
@@ -0,0 +1,481 @@ |
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 flag-o-matic |
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="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" |
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 |
+ tc-is-gcc && filter-lto # GCC miscompiles LLVM, bug #873670 |
292 |
+ |
293 |
+ local mycmakeargs=( |
294 |
+ -DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}") |
295 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}" |
296 |
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man" |
297 |
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang" |
298 |
+ # relative to bindir |
299 |
+ -DCLANG_RESOURCE_DIR="../../../../lib/clang/${LLVM_MAJOR}" |
300 |
+ |
301 |
+ -DBUILD_SHARED_LIBS=OFF |
302 |
+ -DCLANG_LINK_CLANG_DYLIB=ON |
303 |
+ -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) |
304 |
+ -DCLANG_INCLUDE_TESTS=$(usex test) |
305 |
+ |
306 |
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
307 |
+ |
308 |
+ # these are not propagated reliably, so redefine them |
309 |
+ -DLLVM_ENABLE_EH=ON |
310 |
+ -DLLVM_ENABLE_RTTI=ON |
311 |
+ |
312 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) |
313 |
+ # libgomp support fails to find headers without explicit -I |
314 |
+ # furthermore, it provides only syntax checking |
315 |
+ -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp |
316 |
+ |
317 |
+ # disable using CUDA to autodetect GPU, just build for all |
318 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON |
319 |
+ # disable linking to HSA to avoid automagic dep, |
320 |
+ # load it dynamically instead |
321 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_hsa-runtime64=ON |
322 |
+ |
323 |
+ -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) |
324 |
+ |
325 |
+ -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) |
326 |
+ -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) |
327 |
+ |
328 |
+ -DPython3_EXECUTABLE="${PYTHON}" |
329 |
+ ) |
330 |
+ |
331 |
+ if ! use elibc_musl; then |
332 |
+ mycmakeargs+=( |
333 |
+ -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=$(usex ieee-long-double) |
334 |
+ ) |
335 |
+ fi |
336 |
+ |
337 |
+ use test && mycmakeargs+=( |
338 |
+ -DLLVM_BUILD_TESTS=ON |
339 |
+ -DLLVM_LIT_ARGS="$(get_lit_flags)" |
340 |
+ ) |
341 |
+ |
342 |
+ if multilib_is_native_abi; then |
343 |
+ local build_docs=OFF |
344 |
+ if llvm_are_manpages_built; then |
345 |
+ build_docs=ON |
346 |
+ mycmakeargs+=( |
347 |
+ -DLLVM_BUILD_DOCS=ON |
348 |
+ -DLLVM_ENABLE_SPHINX=ON |
349 |
+ -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" |
350 |
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF |
351 |
+ ) |
352 |
+ if use extra; then |
353 |
+ mycmakeargs+=( |
354 |
+ -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" |
355 |
+ ) |
356 |
+ fi |
357 |
+ fi |
358 |
+ mycmakeargs+=( |
359 |
+ -DCLANG_INCLUDE_DOCS=${build_docs} |
360 |
+ ) |
361 |
+ fi |
362 |
+ if multilib_native_use extra; then |
363 |
+ mycmakeargs+=( |
364 |
+ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra |
365 |
+ -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} |
366 |
+ ) |
367 |
+ else |
368 |
+ mycmakeargs+=( |
369 |
+ -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF |
370 |
+ ) |
371 |
+ fi |
372 |
+ |
373 |
+ if [[ -n ${EPREFIX} ]]; then |
374 |
+ mycmakeargs+=( |
375 |
+ -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" |
376 |
+ ) |
377 |
+ fi |
378 |
+ |
379 |
+ if tc-is-cross-compiler; then |
380 |
+ has_version -b sys-devel/clang:${LLVM_MAJOR} || |
381 |
+ die "sys-devel/clang:${LLVM_MAJOR} is required on the build host." |
382 |
+ local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin |
383 |
+ mycmakeargs+=( |
384 |
+ -DLLVM_TOOLS_BINARY_DIR="${tools_bin}" |
385 |
+ -DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen |
386 |
+ ) |
387 |
+ fi |
388 |
+ |
389 |
+ # LLVM can have very high memory consumption while linking, |
390 |
+ # exhausting the limit on 32-bit linker executable |
391 |
+ use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" |
392 |
+ |
393 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
394 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
395 |
+ cmake_src_configure |
396 |
+ |
397 |
+ multilib_is_native_abi && check_distribution_components |
398 |
+} |
399 |
+ |
400 |
+multilib_src_compile() { |
401 |
+ cmake_build distribution |
402 |
+ |
403 |
+ # provide a symlink for tests |
404 |
+ if [[ ! -L ${WORKDIR}/lib/clang ]]; then |
405 |
+ mkdir -p "${WORKDIR}"/lib || die |
406 |
+ ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die |
407 |
+ fi |
408 |
+} |
409 |
+ |
410 |
+multilib_src_test() { |
411 |
+ # respect TMPDIR! |
412 |
+ local -x LIT_PRESERVES_TMP=1 |
413 |
+ local test_targets=( check-clang ) |
414 |
+ if multilib_native_use extra; then |
415 |
+ test_targets+=( |
416 |
+ check-clang-tools |
417 |
+ check-clangd |
418 |
+ ) |
419 |
+ fi |
420 |
+ cmake_build "${test_targets[@]}" |
421 |
+} |
422 |
+ |
423 |
+src_install() { |
424 |
+ MULTILIB_WRAPPED_HEADERS=( |
425 |
+ /usr/include/clang/Config/config.h |
426 |
+ ) |
427 |
+ |
428 |
+ multilib-minimal_src_install |
429 |
+ |
430 |
+ # Move runtime headers to /usr/lib/clang, where they belong |
431 |
+ mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die |
432 |
+ # move (remaining) wrapped headers back |
433 |
+ if use extra; then |
434 |
+ mv "${T}"/clang-tidy "${ED}"/usr/include/ || die |
435 |
+ fi |
436 |
+ mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include || die |
437 |
+ |
438 |
+ # Apply CHOST and version suffix to clang tools |
439 |
+ local clang_tools=( clang clang++ clang-cl clang-cpp ) |
440 |
+ local abi i |
441 |
+ |
442 |
+ # cmake gives us: |
443 |
+ # - clang-X |
444 |
+ # - clang -> clang-X |
445 |
+ # - clang++, clang-cl, clang-cpp -> clang |
446 |
+ # we want to have: |
447 |
+ # - clang-X |
448 |
+ # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X |
449 |
+ # - clang, clang++, clang-cl, clang-cpp -> clang*-X |
450 |
+ # also in CHOST variant |
451 |
+ for i in "${clang_tools[@]:1}"; do |
452 |
+ rm "${ED}/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}" || die |
453 |
+ dosym "clang-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}-${LLVM_MAJOR}" |
454 |
+ dosym "${i}-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}" |
455 |
+ done |
456 |
+ |
457 |
+ # now create target symlinks for all supported ABIs |
458 |
+ for abi in $(get_all_abis); do |
459 |
+ local abi_chost=$(get_abi_CHOST "${abi}") |
460 |
+ for i in "${clang_tools[@]}"; do |
461 |
+ dosym "${i}-${LLVM_MAJOR}" \ |
462 |
+ "/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}-${LLVM_MAJOR}" |
463 |
+ dosym "${abi_chost}-${i}-${LLVM_MAJOR}" \ |
464 |
+ "/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}" |
465 |
+ done |
466 |
+ done |
467 |
+} |
468 |
+ |
469 |
+multilib_src_install() { |
470 |
+ DESTDIR=${D} cmake_build install-distribution |
471 |
+ |
472 |
+ # move headers to /usr/include for wrapping & ABI mismatch checks |
473 |
+ # (also drop the version suffix from runtime headers) |
474 |
+ rm -rf "${ED}"/usr/include || die |
475 |
+ mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include "${ED}"/usr/include || die |
476 |
+ mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die |
477 |
+ if multilib_native_use extra; then |
478 |
+ # don't wrap clang-tidy headers, the list is too long |
479 |
+ # (they're fine for non-native ABI but enabling the targets is problematic) |
480 |
+ mv "${ED}"/usr/include/clang-tidy "${T}/" || die |
481 |
+ fi |
482 |
+} |
483 |
+ |
484 |
+multilib_src_install_all() { |
485 |
+ python_fix_shebang "${ED}" |
486 |
+ if use static-analyzer; then |
487 |
+ python_optimize "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/share/scan-view |
488 |
+ fi |
489 |
+ |
490 |
+ docompress "/usr/lib/llvm/${LLVM_MAJOR}/share/man" |
491 |
+ llvm_install_manpages |
492 |
+ # match 'html' non-compression |
493 |
+ use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" |
494 |
+ # +x for some reason; TODO: investigate |
495 |
+ use static-analyzer && fperms a-x "/usr/lib/llvm/${LLVM_MAJOR}/share/man/man1/scan-build.1" |
496 |
+} |
497 |
+ |
498 |
+pkg_postinst() { |
499 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
500 |
+ eselect compiler-shadow update all |
501 |
+ fi |
502 |
+ |
503 |
+ elog "You can find additional utility scripts in:" |
504 |
+ elog " ${EROOT}/usr/lib/llvm/${LLVM_MAJOR}/share/clang" |
505 |
+ if use extra; then |
506 |
+ elog "Some of them are vim integration scripts (with instructions inside)." |
507 |
+ elog "The run-clang-tidy.py script requires the following additional package:" |
508 |
+ elog " dev-python/pyyaml" |
509 |
+ fi |
510 |
+} |
511 |
+ |
512 |
+pkg_postrm() { |
513 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
514 |
+ eselect compiler-shadow clean all |
515 |
+ fi |
516 |
+} |