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: Sat, 18 Mar 2023 15:03:30
Message-Id: 1679151785.4dd8c7020c5de84ab449a3d85cbad021fd388176.mgorny@gentoo
1 commit: 4dd8c7020c5de84ab449a3d85cbad021fd388176
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 18 07:39:08 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=4dd8c702
7
8 sys-devel/clang-common: Bump to 16.0.0
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-devel/clang-common/Manifest | 2 +
13 sys-devel/clang-common/clang-common-16.0.0.ebuild | 177 ++++++++++++++++++++++
14 2 files changed, 179 insertions(+)
15
16 diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest
17 index ac2c7f3d69fc..b1c047b45e06 100644
18 --- a/sys-devel/clang-common/Manifest
19 +++ b/sys-devel/clang-common/Manifest
20 @@ -2,6 +2,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-common/clang-common-16.0.0.ebuild b/sys-devel/clang-common/clang-common-16.0.0.ebuild
31 new file mode 100644
32 index 000000000000..784fa3ae7a88
33 --- /dev/null
34 +++ b/sys-devel/clang-common/clang-common-16.0.0.ebuild
35 @@ -0,0 +1,177 @@
36 +# Copyright 1999-2023 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=8
40 +
41 +inherit bash-completion-r1 llvm.org
42 +
43 +DESCRIPTION="Common files shared between multiple slots of clang"
44 +HOMEPAGE="https://llvm.org/"
45 +
46 +LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
47 +SLOT="0"
48 +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos"
49 +IUSE="
50 + default-compiler-rt default-libcxx default-lld llvm-libunwind
51 + hardened stricter
52 +"
53 +
54 +PDEPEND="
55 + sys-devel/clang:*
56 + default-compiler-rt? (
57 + sys-devel/clang-runtime[compiler-rt]
58 + llvm-libunwind? ( sys-libs/llvm-libunwind[static-libs] )
59 + !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
60 + )
61 + !default-compiler-rt? ( sys-devel/gcc )
62 + default-libcxx? ( >=sys-libs/libcxx-${PV} )
63 + !default-libcxx? ( sys-devel/gcc )
64 + default-lld? ( sys-devel/lld )
65 + !default-lld? ( sys-devel/binutils )
66 +"
67 +IDEPEND="
68 + !default-compiler-rt? ( sys-devel/gcc-config )
69 + !default-libcxx? ( sys-devel/gcc-config )
70 +"
71 +
72 +LLVM_COMPONENTS=( clang/utils )
73 +llvm.org_set_globals
74 +
75 +pkg_pretend() {
76 + [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return
77 +
78 + local flag missing_flags=()
79 + for flag in default-{compiler-rt,libcxx,lld}; do
80 + if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then
81 + missing_flags+=( "${flag}" )
82 + fi
83 + done
84 +
85 + if [[ ${missing_flags[@]} ]]; then
86 + eerror "It seems that you have the following flags set on sys-devel/clang:"
87 + eerror
88 + eerror " ${missing_flags[*]}"
89 + eerror
90 + eerror "The default runtimes are now set via flags on sys-devel/clang-common."
91 + eerror "The build is being aborted to prevent breakage. Please either set"
92 + eerror "the respective flags on this ebuild, e.g.:"
93 + eerror
94 + eerror " sys-devel/clang-common ${missing_flags[*]}"
95 + eerror
96 + eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1."
97 + die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common"
98 + fi
99 +}
100 +
101 +src_install() {
102 + newbashcomp bash-autocomplete.sh clang
103 +
104 + insinto /etc/clang
105 + newins - gentoo-runtimes.cfg <<-EOF
106 + # This file is initially generated by sys-devel/clang-runtime.
107 + # It is used to control the default runtimes using by clang.
108 +
109 + --rtlib=$(usex default-compiler-rt compiler-rt libgcc)
110 + --unwindlib=$(usex default-compiler-rt libunwind libgcc)
111 + --stdlib=$(usex default-libcxx libc++ libstdc++)
112 + -fuse-ld=$(usex default-lld lld bfd)
113 + EOF
114 +
115 + newins - gentoo-gcc-install.cfg <<-EOF
116 + # This file is maintained by gcc-config.
117 + # It is used to specify the selected GCC installation.
118 + EOF
119 +
120 + newins - gentoo-common.cfg <<-EOF
121 + # This file contains flags common to clang, clang++ and clang-cpp.
122 + @gentoo-runtimes.cfg
123 + @gentoo-gcc-install.cfg
124 + @gentoo-hardened.cfg
125 + EOF
126 +
127 + # Baseline hardening (bug #851111)
128 + newins - gentoo-hardened.cfg <<-EOF
129 + # Some of these options are added unconditionally, regardless of
130 + # USE=hardened, for parity with sys-devel/gcc.
131 + -fstack-clash-protection
132 + -fstack-protector-strong
133 + -fPIE
134 + -include "${EPREFIX}/usr/include/gentoo/fortify.h"
135 + EOF
136 +
137 + dodir /usr/include/gentoo
138 +
139 + local fortify_level=$(usex hardened 3 2)
140 + # We have to do this because glibc's headers warn if F_S is set
141 + # without optimization and that would at the very least be very noisy
142 + # during builds and at worst trigger many -Werror builds.
143 + cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
144 + #ifndef _FORTIFY_SOURCE
145 + # if defined(__has_feature)
146 + # define __GENTOO_HAS_FEATURE(x) __has_feature(x)
147 + # else
148 + # define __GENTOO_HAS_FEATURE(x) 0
149 + # endif
150 + #
151 + # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
152 + # if !defined(__SANITIZE_ADDRESS__) && !__GENTOO_HAS_FEATURE(address_sanitizer) && !__GENTOO_HAS_FEATURE(memory_sanitizer)
153 + # define _FORTIFY_SOURCE ${fortify_level}
154 + # endif
155 + # endif
156 + # undef __GENTOO_HAS_FEATURE
157 + #endif
158 + EOF
159 +
160 + if use hardened ; then
161 + cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
162 + # Options below are conditional on USE=hardened.
163 + -D_GLIBCXX_ASSERTIONS
164 +
165 + # Analogue to GLIBCXX_ASSERTIONS
166 + # https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
167 + -D_LIBCPP_ENABLE_ASSERTIONS=1
168 + EOF
169 + fi
170 +
171 + if use stricter; then
172 + newins - gentoo-stricter.cfg <<-EOF
173 + # This file increases the strictness of older clang versions
174 + # to match the newest upstream version.
175 +
176 + # clang-16 defaults
177 + -Werror=implicit-function-declaration
178 + -Werror=implicit-int
179 + -Werror=incompatible-function-pointer-types
180 +
181 + # constructs banned by C2x
182 + -Werror=deprecated-non-prototype
183 +
184 + # deprecated but large blast radius
185 + #-Werror=strict-prototypes
186 + EOF
187 +
188 + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
189 + @gentoo-stricter.cfg
190 + EOF
191 + fi
192 +
193 + local tool
194 + for tool in clang{,++,-cpp}; do
195 + newins - "${tool}.cfg" <<-EOF
196 + # This configuration file is used by ${tool} driver.
197 + @gentoo-common.cfg
198 + EOF
199 + done
200 +}
201 +
202 +pkg_preinst() {
203 + if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc
204 + then
205 + local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
206 + if [[ -n ${gcc_path} ]]; then
207 + cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
208 + --gcc-install-dir="${gcc_path%%:*}"
209 + EOF
210 + fi
211 + fi
212 +}