1 |
commit: bf25b57ea645de70edfa0798d7392349a75c222a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 30 13:11:50 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 30 14:52:15 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf25b57e |
7 |
|
8 |
sys-devel/clang-common: Install config files for clang 16.x |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
.../clang-common/clang-common-16.0.0.9999.ebuild | 76 +++++++++++++++++++++- |
13 |
.../clang-common-16.0.0_pre20220930.ebuild | 76 +++++++++++++++++++++- |
14 |
sys-devel/clang-common/metadata.xml | 5 ++ |
15 |
3 files changed, 155 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild |
18 |
index 1285500128bb..67012cf2b988 100644 |
19 |
--- a/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild |
20 |
+++ b/sys-devel/clang-common/clang-common-16.0.0.9999.ebuild |
21 |
@@ -3,7 +3,7 @@ |
22 |
|
23 |
EAPI=8 |
24 |
|
25 |
-inherit bash-completion-r1 llvm.org |
26 |
+inherit bash-completion-r1 llvm.org multilib |
27 |
|
28 |
DESCRIPTION="Common files shared between multiple slots of clang" |
29 |
HOMEPAGE="https://llvm.org/" |
30 |
@@ -11,14 +11,88 @@ HOMEPAGE="https://llvm.org/" |
31 |
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" |
32 |
SLOT="0" |
33 |
KEYWORDS="" |
34 |
+IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" |
35 |
|
36 |
PDEPEND=" |
37 |
sys-devel/clang:* |
38 |
+ default-compiler-rt? ( |
39 |
+ =sys-libs/compiler-rt-${PV%_*}* |
40 |
+ llvm-libunwind? ( sys-libs/llvm-libunwind ) |
41 |
+ !llvm-libunwind? ( sys-libs/libunwind ) |
42 |
+ ) |
43 |
+ default-libcxx? ( >=sys-libs/libcxx-${PV} ) |
44 |
+ default-lld? ( sys-devel/lld ) |
45 |
" |
46 |
|
47 |
LLVM_COMPONENTS=( clang/utils ) |
48 |
llvm.org_set_globals |
49 |
|
50 |
+pkg_pretend() { |
51 |
+ [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return |
52 |
+ |
53 |
+ local flag missing_flags=() |
54 |
+ for flag in default-{compiler-rt,libcxx,lld}; do |
55 |
+ if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then |
56 |
+ missing_flags+=( "${flag}" ) |
57 |
+ fi |
58 |
+ done |
59 |
+ |
60 |
+ if [[ ${missing_flags[@]} ]]; then |
61 |
+ eerror "It seems that you have the following flags set on sys-devel/clang:" |
62 |
+ eerror |
63 |
+ eerror " ${missing_flags[*]}" |
64 |
+ eerror |
65 |
+ eerror "The default runtimes are now set via flags on sys-devel/clang-common." |
66 |
+ eerror "The build is being aborted to prevent breakage. Please either set" |
67 |
+ eerror "the respective flags on this ebuild, e.g.:" |
68 |
+ eerror |
69 |
+ eerror " sys-devel/clang-common ${missing_flags[*]}" |
70 |
+ eerror |
71 |
+ eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1." |
72 |
+ die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common" |
73 |
+ fi |
74 |
+} |
75 |
+ |
76 |
+usec() { |
77 |
+ usex "default-${1}" "" "# " |
78 |
+} |
79 |
+ |
80 |
src_install() { |
81 |
newbashcomp bash-autocomplete.sh clang |
82 |
+ |
83 |
+ insinto /etc/clang |
84 |
+ newins - gentoo-runtimes.cfg <<-EOF |
85 |
+ # This file is initially generated by sys-devel/clang-runtime. |
86 |
+ # It is used to control the default runtimes using by clang. |
87 |
+ |
88 |
+ $(usec compiler-rt)-rtlib=compiler-rt |
89 |
+ $(usec compiler-rt)-unwindlib=libunwind |
90 |
+ $(usec libcxx)-stdlib=libc++ |
91 |
+ $(usec lld)-fuse-ld=lld |
92 |
+ EOF |
93 |
+ |
94 |
+ newins - gentoo-gcc-install.cfg <<-EOF |
95 |
+ # This file is maintained by gcc-config. |
96 |
+ # It is used to specify the selected GCC installation. |
97 |
+ EOF |
98 |
+ |
99 |
+ local tool |
100 |
+ for tool in clang{,++,-cpp}; do |
101 |
+ newins - "${tool}.cfg" <<-EOF |
102 |
+ # This configuration file is used by ${tool} driver. |
103 |
+ @gentoo-runtimes.cfg |
104 |
+ @gentoo-gcc-install.cfg |
105 |
+ EOF |
106 |
+ done |
107 |
+} |
108 |
+ |
109 |
+pkg_preinst() { |
110 |
+ # TODO: move this to gcc-config and call it here? |
111 |
+ |
112 |
+ local gcc_path=$(gcc-config --get-lib-path 2>/dev/null) |
113 |
+ if [[ -n ${gcc_path} ]]; then |
114 |
+ cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF |
115 |
+ --gcc-install-dir=${gcc_path%%:*} |
116 |
+ EOF |
117 |
+ fi |
118 |
} |
119 |
|
120 |
diff --git a/sys-devel/clang-common/clang-common-16.0.0_pre20220930.ebuild b/sys-devel/clang-common/clang-common-16.0.0_pre20220930.ebuild |
121 |
index 1285500128bb..67012cf2b988 100644 |
122 |
--- a/sys-devel/clang-common/clang-common-16.0.0_pre20220930.ebuild |
123 |
+++ b/sys-devel/clang-common/clang-common-16.0.0_pre20220930.ebuild |
124 |
@@ -3,7 +3,7 @@ |
125 |
|
126 |
EAPI=8 |
127 |
|
128 |
-inherit bash-completion-r1 llvm.org |
129 |
+inherit bash-completion-r1 llvm.org multilib |
130 |
|
131 |
DESCRIPTION="Common files shared between multiple slots of clang" |
132 |
HOMEPAGE="https://llvm.org/" |
133 |
@@ -11,14 +11,88 @@ HOMEPAGE="https://llvm.org/" |
134 |
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" |
135 |
SLOT="0" |
136 |
KEYWORDS="" |
137 |
+IUSE="default-compiler-rt default-libcxx default-lld llvm-libunwind" |
138 |
|
139 |
PDEPEND=" |
140 |
sys-devel/clang:* |
141 |
+ default-compiler-rt? ( |
142 |
+ =sys-libs/compiler-rt-${PV%_*}* |
143 |
+ llvm-libunwind? ( sys-libs/llvm-libunwind ) |
144 |
+ !llvm-libunwind? ( sys-libs/libunwind ) |
145 |
+ ) |
146 |
+ default-libcxx? ( >=sys-libs/libcxx-${PV} ) |
147 |
+ default-lld? ( sys-devel/lld ) |
148 |
" |
149 |
|
150 |
LLVM_COMPONENTS=( clang/utils ) |
151 |
llvm.org_set_globals |
152 |
|
153 |
+pkg_pretend() { |
154 |
+ [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return |
155 |
+ |
156 |
+ local flag missing_flags=() |
157 |
+ for flag in default-{compiler-rt,libcxx,lld}; do |
158 |
+ if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; then |
159 |
+ missing_flags+=( "${flag}" ) |
160 |
+ fi |
161 |
+ done |
162 |
+ |
163 |
+ if [[ ${missing_flags[@]} ]]; then |
164 |
+ eerror "It seems that you have the following flags set on sys-devel/clang:" |
165 |
+ eerror |
166 |
+ eerror " ${missing_flags[*]}" |
167 |
+ eerror |
168 |
+ eerror "The default runtimes are now set via flags on sys-devel/clang-common." |
169 |
+ eerror "The build is being aborted to prevent breakage. Please either set" |
170 |
+ eerror "the respective flags on this ebuild, e.g.:" |
171 |
+ eerror |
172 |
+ eerror " sys-devel/clang-common ${missing_flags[*]}" |
173 |
+ eerror |
174 |
+ eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1." |
175 |
+ die "Mismatched defaults detected between sys-devel/clang and sys-devel/clang-common" |
176 |
+ fi |
177 |
+} |
178 |
+ |
179 |
+usec() { |
180 |
+ usex "default-${1}" "" "# " |
181 |
+} |
182 |
+ |
183 |
src_install() { |
184 |
newbashcomp bash-autocomplete.sh clang |
185 |
+ |
186 |
+ insinto /etc/clang |
187 |
+ newins - gentoo-runtimes.cfg <<-EOF |
188 |
+ # This file is initially generated by sys-devel/clang-runtime. |
189 |
+ # It is used to control the default runtimes using by clang. |
190 |
+ |
191 |
+ $(usec compiler-rt)-rtlib=compiler-rt |
192 |
+ $(usec compiler-rt)-unwindlib=libunwind |
193 |
+ $(usec libcxx)-stdlib=libc++ |
194 |
+ $(usec lld)-fuse-ld=lld |
195 |
+ EOF |
196 |
+ |
197 |
+ newins - gentoo-gcc-install.cfg <<-EOF |
198 |
+ # This file is maintained by gcc-config. |
199 |
+ # It is used to specify the selected GCC installation. |
200 |
+ EOF |
201 |
+ |
202 |
+ local tool |
203 |
+ for tool in clang{,++,-cpp}; do |
204 |
+ newins - "${tool}.cfg" <<-EOF |
205 |
+ # This configuration file is used by ${tool} driver. |
206 |
+ @gentoo-runtimes.cfg |
207 |
+ @gentoo-gcc-install.cfg |
208 |
+ EOF |
209 |
+ done |
210 |
+} |
211 |
+ |
212 |
+pkg_preinst() { |
213 |
+ # TODO: move this to gcc-config and call it here? |
214 |
+ |
215 |
+ local gcc_path=$(gcc-config --get-lib-path 2>/dev/null) |
216 |
+ if [[ -n ${gcc_path} ]]; then |
217 |
+ cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF |
218 |
+ --gcc-install-dir=${gcc_path%%:*} |
219 |
+ EOF |
220 |
+ fi |
221 |
} |
222 |
|
223 |
diff --git a/sys-devel/clang-common/metadata.xml b/sys-devel/clang-common/metadata.xml |
224 |
index 072910296ca3..31c80b4fb555 100644 |
225 |
--- a/sys-devel/clang-common/metadata.xml |
226 |
+++ b/sys-devel/clang-common/metadata.xml |
227 |
@@ -7,4 +7,9 @@ |
228 |
<upstream> |
229 |
<remote-id type="github">llvm/llvm-project</remote-id> |
230 |
</upstream> |
231 |
+ <use> |
232 |
+ <flag name="default-compiler-rt">Use compiler-rt + libunwind instead of libgcc as the default rtlib for clang</flag> |
233 |
+ <flag name="default-libcxx">Use libc++ instead of libstdc++ as the default stdlib for clang</flag> |
234 |
+ <flag name="default-lld">Use lld as the default linker for clang</flag> |
235 |
+ </use> |
236 |
</pkgmetadata> |