Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang-common/
Date: Mon, 20 Mar 2023 13:11:07
Message-Id: 1679317852.b2f6ec858dd2a6c10d7aa846ceafa6d3454d7521.mgorny@gentoo
1 commit: b2f6ec858dd2a6c10d7aa846ceafa6d3454d7521
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 20 13:09:04 2023 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 20 13:10:52 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2f6ec85
7
8 sys-devel/clang-common: Remove old
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-devel/clang-common/Manifest | 5 -
13 .../clang-common/clang-common-16.0.0_rc3-r2.ebuild | 177 ---------------------
14 .../clang-common/clang-common-16.0.0_rc4-r1.ebuild | 177 ---------------------
15 .../clang-common-17.0.0_pre20230304-r1.ebuild | 177 ---------------------
16 4 files changed, 536 deletions(-)
17
18 diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest
19 index b1c047b45e06..52a376db7b69 100644
20 --- a/sys-devel/clang-common/Manifest
21 +++ b/sys-devel/clang-common/Manifest
22 @@ -4,9 +4,4 @@ DIST llvm-project-15.0.7.src.tar.xz 110936452 BLAKE2B f3d277e2029157329e5be78b78
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 -DIST llvm-project-16.0.0rc4.src.tar.xz.sig 566 BLAKE2B bfcf39070f32e16cfeae699d95d06f184b1331c3af403340c31cc5a973a3bb1faec0b6342445176cebed5819ddf68e4abfdaa8542ec425b1c822fc8c03c03349 SHA512 2af72e3d771e2361873007a944dcccfe81fbdbc3025a2101e03cbc15f1a173d39ceb94c4ae8966b1d7564bf004ee9a5ffa032e2334c0cf7154aea1090d04b00f
30 -DIST llvm-project-2708869801ae00f4681f6b2d9d69b25b3fce26b6.tar.gz 180523586 BLAKE2B cf918d1e23f922d201a44531c9765b7d8ec2b3b8499ea7954845abcd5fa2687e85b3a34819a583c4f4a6d6e1baa49dbac0b4450cd6b9b322b0f13c88cd7da93c SHA512 18cb00e93d819993a925ae0467d382bc952d82c1eb92dbbb5bb3cdf87043269948670713734ddc3ea4ec50544e54dd11b6747496f7eaa02479374ab9ad075aa5
31 DIST llvm-project-4bf004e07e2b9d6e04e3f33e1b02628c679de664.tar.gz 180304467 BLAKE2B 6750855453b575eb8fcc861d5b24b144497bba62df9b9292ac586cf340e04b2b58290fe9df6d89142f29b56aa37ddeb3bd11cc3337e4dc985a4487954d1e2ffa SHA512 d8a87064ba0f92967df019e9345222b87cda81852a9599902cedc4a49ec7d9e2175c972b7fa6d19920489c1d309822f9c31c23bdce0376a8d40c71d57bcd5068
32
33 diff --git a/sys-devel/clang-common/clang-common-16.0.0_rc3-r2.ebuild b/sys-devel/clang-common/clang-common-16.0.0_rc3-r2.ebuild
34 deleted file mode 100644
35 index 1f768ea302a9..000000000000
36 --- a/sys-devel/clang-common/clang-common-16.0.0_rc3-r2.ebuild
37 +++ /dev/null
38 @@ -1,177 +0,0 @@
39 -# Copyright 1999-2023 Gentoo Authors
40 -# Distributed under the terms of the GNU General Public License v2
41 -
42 -EAPI=8
43 -
44 -inherit bash-completion-r1 llvm.org
45 -
46 -DESCRIPTION="Common files shared between multiple slots of clang"
47 -HOMEPAGE="https://llvm.org/"
48 -
49 -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
50 -SLOT="0"
51 -KEYWORDS="~loong"
52 -IUSE="
53 - default-compiler-rt default-libcxx default-lld llvm-libunwind
54 - hardened stricter
55 -"
56 -
57 -PDEPEND="
58 - sys-devel/clang:*
59 - default-compiler-rt? (
60 - sys-devel/clang-runtime[compiler-rt]
61 - llvm-libunwind? ( sys-libs/llvm-libunwind[static-libs] )
62 - !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
63 - )
64 - !default-compiler-rt? ( sys-devel/gcc )
65 - default-libcxx? ( >=sys-libs/libcxx-${PV} )
66 - !default-libcxx? ( sys-devel/gcc )
67 - default-lld? ( sys-devel/lld )
68 - !default-lld? ( sys-devel/binutils )
69 -"
70 -IDEPEND="
71 - !default-compiler-rt? ( sys-devel/gcc-config )
72 - !default-libcxx? ( sys-devel/gcc-config )
73 -"
74 -
75 -LLVM_COMPONENTS=( clang/utils )
76 -llvm.org_set_globals
77 -
78 -pkg_pretend() {
79 - [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return
80 -
81 - local flag missing_flags=()
82 - for flag in default-{compiler-rt,libcxx,lld}; do
83 - if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then
84 - missing_flags+=( "${flag}" )
85 - fi
86 - done
87 -
88 - if [[ ${missing_flags[@]} ]]; then
89 - eerror "It seems that you have the following flags set on sys-devel/clang:"
90 - eerror
91 - eerror " ${missing_flags[*]}"
92 - eerror
93 - eerror "The default runtimes are now set via flags on sys-devel/clang-common."
94 - eerror "The build is being aborted to prevent breakage. Please either set"
95 - eerror "the respective flags on this ebuild, e.g.:"
96 - eerror
97 - eerror " sys-devel/clang-common ${missing_flags[*]}"
98 - eerror
99 - eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1."
100 - die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common"
101 - fi
102 -}
103 -
104 -src_install() {
105 - newbashcomp bash-autocomplete.sh clang
106 -
107 - insinto /etc/clang
108 - newins - gentoo-runtimes.cfg <<-EOF
109 - # This file is initially generated by sys-devel/clang-runtime.
110 - # It is used to control the default runtimes using by clang.
111 -
112 - --rtlib=$(usex default-compiler-rt compiler-rt libgcc)
113 - --unwindlib=$(usex default-compiler-rt libunwind libgcc)
114 - --stdlib=$(usex default-libcxx libc++ libstdc++)
115 - -fuse-ld=$(usex default-lld lld bfd)
116 - EOF
117 -
118 - newins - gentoo-gcc-install.cfg <<-EOF
119 - # This file is maintained by gcc-config.
120 - # It is used to specify the selected GCC installation.
121 - EOF
122 -
123 - newins - gentoo-common.cfg <<-EOF
124 - # This file contains flags common to clang, clang++ and clang-cpp.
125 - @gentoo-runtimes.cfg
126 - @gentoo-gcc-install.cfg
127 - @gentoo-hardened.cfg
128 - EOF
129 -
130 - # Baseline hardening (bug #851111)
131 - newins - gentoo-hardened.cfg <<-EOF
132 - # Some of these options are added unconditionally, regardless of
133 - # USE=hardened, for parity with sys-devel/gcc.
134 - -fstack-clash-protection
135 - -fstack-protector-strong
136 - -fPIE
137 - -include "${EPREFIX}/usr/include/gentoo/fortify.h"
138 - EOF
139 -
140 - dodir /usr/include/gentoo
141 -
142 - local fortify_level=$(usex hardened 3 2)
143 - # We have to do this because glibc's headers warn if F_S is set
144 - # without optimization and that would at the very least be very noisy
145 - # during builds and at worst trigger many -Werror builds.
146 - cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
147 - #ifndef _FORTIFY_SOURCE
148 - # if defined(__has_feature)
149 - # define __GENTOO_HAS_FEATURE(x) __has_feature(x)
150 - # else
151 - # define __GENTOO_HAS_FEATURE(x) 0
152 - # endif
153 - #
154 - # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
155 - # if !defined(__SANITIZE_ADDRESS__) && !__GENTOO_HAS_FEATURE(address_sanitizer) && !__GENTOO_HAS_FEATURE(memory_sanitizer)
156 - # define _FORTIFY_SOURCE ${fortify_level}
157 - # endif
158 - # endif
159 - # undef __GENTOO_HAS_FEATURE
160 - #endif
161 - EOF
162 -
163 - if use hardened ; then
164 - cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
165 - # Options below are conditional on USE=hardened.
166 - -D_GLIBCXX_ASSERTIONS
167 -
168 - # Analogue to GLIBCXX_ASSERTIONS
169 - # https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
170 - -D_LIBCPP_ENABLE_ASSERTIONS=1
171 - EOF
172 - fi
173 -
174 - if use stricter; then
175 - newins - gentoo-stricter.cfg <<-EOF
176 - # This file increases the strictness of older clang versions
177 - # to match the newest upstream version.
178 -
179 - # clang-16 defaults
180 - -Werror=implicit-function-declaration
181 - -Werror=implicit-int
182 - -Werror=incompatible-function-pointer-types
183 -
184 - # constructs banned by C2x
185 - -Werror=deprecated-non-prototype
186 -
187 - # deprecated but large blast radius
188 - #-Werror=strict-prototypes
189 - EOF
190 -
191 - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
192 - @gentoo-stricter.cfg
193 - EOF
194 - fi
195 -
196 - local tool
197 - for tool in clang{,++,-cpp}; do
198 - newins - "${tool}.cfg" <<-EOF
199 - # This configuration file is used by ${tool} driver.
200 - @gentoo-common.cfg
201 - EOF
202 - done
203 -}
204 -
205 -pkg_preinst() {
206 - if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc
207 - then
208 - local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
209 - if [[ -n ${gcc_path} ]]; then
210 - cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
211 - --gcc-install-dir="${gcc_path%%:*}"
212 - EOF
213 - fi
214 - fi
215 -}
216
217 diff --git a/sys-devel/clang-common/clang-common-16.0.0_rc4-r1.ebuild b/sys-devel/clang-common/clang-common-16.0.0_rc4-r1.ebuild
218 deleted file mode 100644
219 index 1f768ea302a9..000000000000
220 --- a/sys-devel/clang-common/clang-common-16.0.0_rc4-r1.ebuild
221 +++ /dev/null
222 @@ -1,177 +0,0 @@
223 -# Copyright 1999-2023 Gentoo Authors
224 -# Distributed under the terms of the GNU General Public License v2
225 -
226 -EAPI=8
227 -
228 -inherit bash-completion-r1 llvm.org
229 -
230 -DESCRIPTION="Common files shared between multiple slots of clang"
231 -HOMEPAGE="https://llvm.org/"
232 -
233 -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
234 -SLOT="0"
235 -KEYWORDS="~loong"
236 -IUSE="
237 - default-compiler-rt default-libcxx default-lld llvm-libunwind
238 - hardened stricter
239 -"
240 -
241 -PDEPEND="
242 - sys-devel/clang:*
243 - default-compiler-rt? (
244 - sys-devel/clang-runtime[compiler-rt]
245 - llvm-libunwind? ( sys-libs/llvm-libunwind[static-libs] )
246 - !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
247 - )
248 - !default-compiler-rt? ( sys-devel/gcc )
249 - default-libcxx? ( >=sys-libs/libcxx-${PV} )
250 - !default-libcxx? ( sys-devel/gcc )
251 - default-lld? ( sys-devel/lld )
252 - !default-lld? ( sys-devel/binutils )
253 -"
254 -IDEPEND="
255 - !default-compiler-rt? ( sys-devel/gcc-config )
256 - !default-libcxx? ( sys-devel/gcc-config )
257 -"
258 -
259 -LLVM_COMPONENTS=( clang/utils )
260 -llvm.org_set_globals
261 -
262 -pkg_pretend() {
263 - [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return
264 -
265 - local flag missing_flags=()
266 - for flag in default-{compiler-rt,libcxx,lld}; do
267 - if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then
268 - missing_flags+=( "${flag}" )
269 - fi
270 - done
271 -
272 - if [[ ${missing_flags[@]} ]]; then
273 - eerror "It seems that you have the following flags set on sys-devel/clang:"
274 - eerror
275 - eerror " ${missing_flags[*]}"
276 - eerror
277 - eerror "The default runtimes are now set via flags on sys-devel/clang-common."
278 - eerror "The build is being aborted to prevent breakage. Please either set"
279 - eerror "the respective flags on this ebuild, e.g.:"
280 - eerror
281 - eerror " sys-devel/clang-common ${missing_flags[*]}"
282 - eerror
283 - eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1."
284 - die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common"
285 - fi
286 -}
287 -
288 -src_install() {
289 - newbashcomp bash-autocomplete.sh clang
290 -
291 - insinto /etc/clang
292 - newins - gentoo-runtimes.cfg <<-EOF
293 - # This file is initially generated by sys-devel/clang-runtime.
294 - # It is used to control the default runtimes using by clang.
295 -
296 - --rtlib=$(usex default-compiler-rt compiler-rt libgcc)
297 - --unwindlib=$(usex default-compiler-rt libunwind libgcc)
298 - --stdlib=$(usex default-libcxx libc++ libstdc++)
299 - -fuse-ld=$(usex default-lld lld bfd)
300 - EOF
301 -
302 - newins - gentoo-gcc-install.cfg <<-EOF
303 - # This file is maintained by gcc-config.
304 - # It is used to specify the selected GCC installation.
305 - EOF
306 -
307 - newins - gentoo-common.cfg <<-EOF
308 - # This file contains flags common to clang, clang++ and clang-cpp.
309 - @gentoo-runtimes.cfg
310 - @gentoo-gcc-install.cfg
311 - @gentoo-hardened.cfg
312 - EOF
313 -
314 - # Baseline hardening (bug #851111)
315 - newins - gentoo-hardened.cfg <<-EOF
316 - # Some of these options are added unconditionally, regardless of
317 - # USE=hardened, for parity with sys-devel/gcc.
318 - -fstack-clash-protection
319 - -fstack-protector-strong
320 - -fPIE
321 - -include "${EPREFIX}/usr/include/gentoo/fortify.h"
322 - EOF
323 -
324 - dodir /usr/include/gentoo
325 -
326 - local fortify_level=$(usex hardened 3 2)
327 - # We have to do this because glibc's headers warn if F_S is set
328 - # without optimization and that would at the very least be very noisy
329 - # during builds and at worst trigger many -Werror builds.
330 - cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
331 - #ifndef _FORTIFY_SOURCE
332 - # if defined(__has_feature)
333 - # define __GENTOO_HAS_FEATURE(x) __has_feature(x)
334 - # else
335 - # define __GENTOO_HAS_FEATURE(x) 0
336 - # endif
337 - #
338 - # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
339 - # if !defined(__SANITIZE_ADDRESS__) && !__GENTOO_HAS_FEATURE(address_sanitizer) && !__GENTOO_HAS_FEATURE(memory_sanitizer)
340 - # define _FORTIFY_SOURCE ${fortify_level}
341 - # endif
342 - # endif
343 - # undef __GENTOO_HAS_FEATURE
344 - #endif
345 - EOF
346 -
347 - if use hardened ; then
348 - cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
349 - # Options below are conditional on USE=hardened.
350 - -D_GLIBCXX_ASSERTIONS
351 -
352 - # Analogue to GLIBCXX_ASSERTIONS
353 - # https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
354 - -D_LIBCPP_ENABLE_ASSERTIONS=1
355 - EOF
356 - fi
357 -
358 - if use stricter; then
359 - newins - gentoo-stricter.cfg <<-EOF
360 - # This file increases the strictness of older clang versions
361 - # to match the newest upstream version.
362 -
363 - # clang-16 defaults
364 - -Werror=implicit-function-declaration
365 - -Werror=implicit-int
366 - -Werror=incompatible-function-pointer-types
367 -
368 - # constructs banned by C2x
369 - -Werror=deprecated-non-prototype
370 -
371 - # deprecated but large blast radius
372 - #-Werror=strict-prototypes
373 - EOF
374 -
375 - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
376 - @gentoo-stricter.cfg
377 - EOF
378 - fi
379 -
380 - local tool
381 - for tool in clang{,++,-cpp}; do
382 - newins - "${tool}.cfg" <<-EOF
383 - # This configuration file is used by ${tool} driver.
384 - @gentoo-common.cfg
385 - EOF
386 - done
387 -}
388 -
389 -pkg_preinst() {
390 - if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc
391 - then
392 - local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
393 - if [[ -n ${gcc_path} ]]; then
394 - cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
395 - --gcc-install-dir="${gcc_path%%:*}"
396 - EOF
397 - fi
398 - fi
399 -}
400
401 diff --git a/sys-devel/clang-common/clang-common-17.0.0_pre20230304-r1.ebuild b/sys-devel/clang-common/clang-common-17.0.0_pre20230304-r1.ebuild
402 deleted file mode 100644
403 index 808c1e1a0ae1..000000000000
404 --- a/sys-devel/clang-common/clang-common-17.0.0_pre20230304-r1.ebuild
405 +++ /dev/null
406 @@ -1,177 +0,0 @@
407 -# Copyright 1999-2023 Gentoo Authors
408 -# Distributed under the terms of the GNU General Public License v2
409 -
410 -EAPI=8
411 -
412 -inherit bash-completion-r1 llvm.org
413 -
414 -DESCRIPTION="Common files shared between multiple slots of clang"
415 -HOMEPAGE="https://llvm.org/"
416 -
417 -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
418 -SLOT="0"
419 -KEYWORDS=""
420 -IUSE="
421 - default-compiler-rt default-libcxx default-lld llvm-libunwind
422 - hardened stricter
423 -"
424 -
425 -PDEPEND="
426 - sys-devel/clang:*
427 - default-compiler-rt? (
428 - sys-devel/clang-runtime[compiler-rt]
429 - llvm-libunwind? ( sys-libs/llvm-libunwind[static-libs] )
430 - !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
431 - )
432 - !default-compiler-rt? ( sys-devel/gcc )
433 - default-libcxx? ( >=sys-libs/libcxx-${PV} )
434 - !default-libcxx? ( sys-devel/gcc )
435 - default-lld? ( sys-devel/lld )
436 - !default-lld? ( sys-devel/binutils )
437 -"
438 -IDEPEND="
439 - !default-compiler-rt? ( sys-devel/gcc-config )
440 - !default-libcxx? ( sys-devel/gcc-config )
441 -"
442 -
443 -LLVM_COMPONENTS=( clang/utils )
444 -llvm.org_set_globals
445 -
446 -pkg_pretend() {
447 - [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return
448 -
449 - local flag missing_flags=()
450 - for flag in default-{compiler-rt,libcxx,lld}; do
451 - if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then
452 - missing_flags+=( "${flag}" )
453 - fi
454 - done
455 -
456 - if [[ ${missing_flags[@]} ]]; then
457 - eerror "It seems that you have the following flags set on sys-devel/clang:"
458 - eerror
459 - eerror " ${missing_flags[*]}"
460 - eerror
461 - eerror "The default runtimes are now set via flags on sys-devel/clang-common."
462 - eerror "The build is being aborted to prevent breakage. Please either set"
463 - eerror "the respective flags on this ebuild, e.g.:"
464 - eerror
465 - eerror " sys-devel/clang-common ${missing_flags[*]}"
466 - eerror
467 - eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1."
468 - die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common"
469 - fi
470 -}
471 -
472 -src_install() {
473 - newbashcomp bash-autocomplete.sh clang
474 -
475 - insinto /etc/clang
476 - newins - gentoo-runtimes.cfg <<-EOF
477 - # This file is initially generated by sys-devel/clang-runtime.
478 - # It is used to control the default runtimes using by clang.
479 -
480 - --rtlib=$(usex default-compiler-rt compiler-rt libgcc)
481 - --unwindlib=$(usex default-compiler-rt libunwind libgcc)
482 - --stdlib=$(usex default-libcxx libc++ libstdc++)
483 - -fuse-ld=$(usex default-lld lld bfd)
484 - EOF
485 -
486 - newins - gentoo-gcc-install.cfg <<-EOF
487 - # This file is maintained by gcc-config.
488 - # It is used to specify the selected GCC installation.
489 - EOF
490 -
491 - newins - gentoo-common.cfg <<-EOF
492 - # This file contains flags common to clang, clang++ and clang-cpp.
493 - @gentoo-runtimes.cfg
494 - @gentoo-gcc-install.cfg
495 - @gentoo-hardened.cfg
496 - EOF
497 -
498 - # Baseline hardening (bug #851111)
499 - newins - gentoo-hardened.cfg <<-EOF
500 - # Some of these options are added unconditionally, regardless of
501 - # USE=hardened, for parity with sys-devel/gcc.
502 - -fstack-clash-protection
503 - -fstack-protector-strong
504 - -fPIE
505 - -include "${EPREFIX}/usr/include/gentoo/fortify.h"
506 - EOF
507 -
508 - dodir /usr/include/gentoo
509 -
510 - local fortify_level=$(usex hardened 3 2)
511 - # We have to do this because glibc's headers warn if F_S is set
512 - # without optimization and that would at the very least be very noisy
513 - # during builds and at worst trigger many -Werror builds.
514 - cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
515 - #ifndef _FORTIFY_SOURCE
516 - # if defined(__has_feature)
517 - # define __GENTOO_HAS_FEATURE(x) __has_feature(x)
518 - # else
519 - # define __GENTOO_HAS_FEATURE(x) 0
520 - # endif
521 - #
522 - # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
523 - # if !defined(__SANITIZE_ADDRESS__) && !__GENTOO_HAS_FEATURE(address_sanitizer) && !__GENTOO_HAS_FEATURE(memory_sanitizer)
524 - # define _FORTIFY_SOURCE ${fortify_level}
525 - # endif
526 - # endif
527 - # undef __GENTOO_HAS_FEATURE
528 - #endif
529 - EOF
530 -
531 - if use hardened ; then
532 - cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
533 - # Options below are conditional on USE=hardened.
534 - -D_GLIBCXX_ASSERTIONS
535 -
536 - # Analogue to GLIBCXX_ASSERTIONS
537 - # https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
538 - -D_LIBCPP_ENABLE_ASSERTIONS=1
539 - EOF
540 - fi
541 -
542 - if use stricter; then
543 - newins - gentoo-stricter.cfg <<-EOF
544 - # This file increases the strictness of older clang versions
545 - # to match the newest upstream version.
546 -
547 - # clang-16 defaults
548 - -Werror=implicit-function-declaration
549 - -Werror=implicit-int
550 - -Werror=incompatible-function-pointer-types
551 -
552 - # constructs banned by C2x
553 - -Werror=deprecated-non-prototype
554 -
555 - # deprecated but large blast radius
556 - #-Werror=strict-prototypes
557 - EOF
558 -
559 - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
560 - @gentoo-stricter.cfg
561 - EOF
562 - fi
563 -
564 - local tool
565 - for tool in clang{,++,-cpp}; do
566 - newins - "${tool}.cfg" <<-EOF
567 - # This configuration file is used by ${tool} driver.
568 - @gentoo-common.cfg
569 - EOF
570 - done
571 -}
572 -
573 -pkg_preinst() {
574 - if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc
575 - then
576 - local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
577 - if [[ -n ${gcc_path} ]]; then
578 - cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
579 - --gcc-install-dir="${gcc_path%%:*}"
580 - EOF
581 - fi
582 - fi
583 -}