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