1 |
commit: 4f61aac04f91a537cb3fd56e97be1395b589fc18 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 14 08:56:48 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 14 09:55:01 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f61aac0 |
7 |
|
8 |
sys-devel/clang: Bump to 9.0.1_rc3 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
sys-devel/clang/Manifest | 1 + |
13 |
sys-devel/clang/clang-9.0.1_rc3.ebuild | 268 +++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 269 insertions(+) |
15 |
|
16 |
diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest |
17 |
index 6c9c1d0802f..23d44f7ee54 100644 |
18 |
--- a/sys-devel/clang/Manifest |
19 |
+++ b/sys-devel/clang/Manifest |
20 |
@@ -11,3 +11,4 @@ DIST llvm-8.0.1.src.tar.xz 30477608 BLAKE2B 4319c837b36111401e3b0f9659b8d875c894 |
21 |
DIST llvm-9.0.0-manpages.tar.bz2 158546 BLAKE2B eed6235698a0b5993affe305f7fd22cd4cf444adf931275a1685f2049a5f17cf2933907577d9ce142348a3c579769b0436aa2b5a9a953958504125a8c3e83b7d SHA512 64c8d18061eb2870b379a1df485be0b61eac07cb10b3f97347b54b2ee326faa63437ca04466776be282e120dd3f6147e14fffdd38ca370db85748fe5eb54d764 |
22 |
DIST llvm-9.0.0.src.tar.xz 32994768 BLAKE2B 7f09bff9bcada95ab9c920c78aef92b57e665d9188bab39c734084ceb03a801c942fed48ea77fabeeb6110c648cb69363c659a6ce93ebf67dbba5c187219b13b SHA512 1bb3341e1d231559b948f1505b33c2e2e03989f9b8bbfef0e0cdaff5ac43f85574c9ec5ac53399b914f497d6899425d861411024e8d7e1d1a338c1c6951ac658 |
23 |
DIST llvmorg-9.0.1-rc2.tar.gz 113203311 BLAKE2B 6e426060853e1587febedb75189444a1451236b713f800a4f3401c54318e48b0f5e0c484e9e4ef261faceed9b43b445a4153b061d4dadcc617047f9320b4f56a SHA512 fececd9365645920b9afdad1e94d5e10553ad4a39d84b3ac811b86014c395d51f7e4dabe54bb095a99481400c408bee3c9a2044168724d5e094e3258587a5d2c |
24 |
+DIST llvmorg-9.0.1-rc3.tar.gz 113205740 BLAKE2B 3ca81e812833ecc2ac1bacfdeb86f54609ee125ba7390ce6af0113e949496149102360f35a9a0194dff93fb5cb6ade40a68382a03a7e55771a13198abb7ca9de SHA512 ea56a4ee57aacdd00a1d6551cdc768ecce3124a0eb6a9d09fe060bb147019a5119b2a9eaca576474be42e0296293daa923edd86dadb6759df0c2d7fc7a74f9f1 |
25 |
|
26 |
diff --git a/sys-devel/clang/clang-9.0.1_rc3.ebuild b/sys-devel/clang/clang-9.0.1_rc3.ebuild |
27 |
new file mode 100644 |
28 |
index 00000000000..ac5562725d7 |
29 |
--- /dev/null |
30 |
+++ b/sys-devel/clang/clang-9.0.1_rc3.ebuild |
31 |
@@ -0,0 +1,268 @@ |
32 |
+# Copyright 1999-2019 Gentoo Authors |
33 |
+# Distributed under the terms of the GNU General Public License v2 |
34 |
+ |
35 |
+EAPI=7 |
36 |
+ |
37 |
+PYTHON_COMPAT=( python{2_7,3_{5,6,7}} ) |
38 |
+inherit cmake-utils llvm llvm.org multilib-minimal multiprocessing \ |
39 |
+ pax-utils python-single-r1 toolchain-funcs |
40 |
+ |
41 |
+DESCRIPTION="C language family frontend for LLVM" |
42 |
+HOMEPAGE="https://llvm.org/" |
43 |
+LLVM_COMPONENTS=( clang clang-tools-extra ) |
44 |
+LLVM_TEST_COMPONENTS=( |
45 |
+ llvm/lib/Testing/Support |
46 |
+ llvm/utils/{lit,llvm-lit,unittest} |
47 |
+) |
48 |
+llvm.org_set_globals |
49 |
+# We need extra level of indirection for CLANG_RESOURCE_DIR |
50 |
+S=${WORKDIR}/x/y/clang |
51 |
+ |
52 |
+# Keep in sync with sys-devel/llvm |
53 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 |
54 |
+ NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) |
55 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
56 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} |
57 |
+ |
58 |
+# MSVCSetupApi.h: MIT |
59 |
+# sorttable.js: MIT |
60 |
+ |
61 |
+LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" |
62 |
+SLOT="$(ver_cut 1)" |
63 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux" |
64 |
+IUSE="debug default-compiler-rt default-libcxx doc +static-analyzer |
65 |
+ test xml kernel_FreeBSD ${ALL_LLVM_TARGETS[*]}" |
66 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
67 |
+ || ( ${ALL_LLVM_TARGETS[*]} )" |
68 |
+RESTRICT="!test? ( test )" |
69 |
+ |
70 |
+RDEPEND=" |
71 |
+ ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${LLVM_TARGET_USEDEPS// /,},${MULTILIB_USEDEP}] |
72 |
+ static-analyzer? ( dev-lang/perl:* ) |
73 |
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) |
74 |
+ ${PYTHON_DEPS}" |
75 |
+DEPEND="${RDEPEND}" |
76 |
+BDEPEND=" |
77 |
+ doc? ( dev-python/sphinx ) |
78 |
+ xml? ( virtual/pkgconfig ) |
79 |
+ ${PYTHON_DEPS}" |
80 |
+RDEPEND="${RDEPEND} |
81 |
+ !<sys-devel/llvm-4.0.0_rc:0 |
82 |
+ !sys-devel/clang:0" |
83 |
+PDEPEND=" |
84 |
+ sys-devel/clang-common |
85 |
+ ~sys-devel/clang-runtime-${PV} |
86 |
+ default-compiler-rt? ( =sys-libs/compiler-rt-${PV%_*}* ) |
87 |
+ default-libcxx? ( >=sys-libs/libcxx-${PV} )" |
88 |
+ |
89 |
+# least intrusive of all |
90 |
+CMAKE_BUILD_TYPE=RelWithDebInfo |
91 |
+ |
92 |
+# Multilib notes: |
93 |
+# 1. ABI_* flags control ABIs libclang* is built for only. |
94 |
+# 2. clang is always capable of compiling code for all ABIs for enabled |
95 |
+# target. However, you will need appropriate crt* files (installed |
96 |
+# e.g. by sys-devel/gcc and sys-libs/glibc). |
97 |
+# 3. ${CHOST}-clang wrappers are always installed for all ABIs included |
98 |
+# in the current profile (i.e. alike supported by sys-devel/gcc). |
99 |
+# |
100 |
+# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need |
101 |
+# multilib clang* libraries (not runtime, not wrappers). |
102 |
+ |
103 |
+pkg_setup() { |
104 |
+ LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup |
105 |
+ python-single-r1_pkg_setup |
106 |
+} |
107 |
+ |
108 |
+src_unpack() { |
109 |
+ # create extra parent dir for CLANG_RESOURCE_DIR |
110 |
+ mkdir -p x/y || die |
111 |
+ cd x/y || die |
112 |
+ llvm.org_src_unpack |
113 |
+ mv clang-tools-extra clang/tools/extra || die |
114 |
+} |
115 |
+ |
116 |
+multilib_src_configure() { |
117 |
+ local llvm_version=$(llvm-config --version) || die |
118 |
+ local clang_version=$(ver_cut 1-3 "${llvm_version}") |
119 |
+ |
120 |
+ local mycmakeargs=( |
121 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" |
122 |
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" |
123 |
+ # relative to bindir |
124 |
+ -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" |
125 |
+ |
126 |
+ -DBUILD_SHARED_LIBS=ON |
127 |
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
128 |
+ -DLLVM_BUILD_TESTS=$(usex test) |
129 |
+ |
130 |
+ # these are not propagated reliably, so redefine them |
131 |
+ -DLLVM_ENABLE_EH=ON |
132 |
+ -DLLVM_ENABLE_RTTI=ON |
133 |
+ |
134 |
+ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) |
135 |
+ # libgomp support fails to find headers without explicit -I |
136 |
+ # furthermore, it provides only syntax checking |
137 |
+ -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp |
138 |
+ |
139 |
+ # override default stdlib and rtlib |
140 |
+ -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") |
141 |
+ -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") |
142 |
+ |
143 |
+ -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) |
144 |
+ -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) |
145 |
+ ) |
146 |
+ use test && mycmakeargs+=( |
147 |
+ -DLLVM_MAIN_SRC_DIR="${WORKDIR}/x/y/llvm" |
148 |
+ -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" |
149 |
+ ) |
150 |
+ |
151 |
+ if multilib_is_native_abi; then |
152 |
+ mycmakeargs+=( |
153 |
+ # normally copied from LLVM_INCLUDE_DOCS but the latter |
154 |
+ # is lacking value in stand-alone builds |
155 |
+ -DCLANG_INCLUDE_DOCS=$(usex doc) |
156 |
+ -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=$(usex doc) |
157 |
+ ) |
158 |
+ use doc && mycmakeargs+=( |
159 |
+ -DLLVM_BUILD_DOCS=ON |
160 |
+ -DLLVM_ENABLE_SPHINX=ON |
161 |
+ -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" |
162 |
+ -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" |
163 |
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF |
164 |
+ ) |
165 |
+ else |
166 |
+ mycmakeargs+=( |
167 |
+ -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF |
168 |
+ ) |
169 |
+ fi |
170 |
+ |
171 |
+ if [[ -n ${EPREFIX} ]]; then |
172 |
+ mycmakeargs+=( |
173 |
+ -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" |
174 |
+ ) |
175 |
+ fi |
176 |
+ |
177 |
+ if tc-is-cross-compiler; then |
178 |
+ [[ -x "/usr/bin/clang-tblgen" ]] \ |
179 |
+ || die "/usr/bin/clang-tblgen not found or usable" |
180 |
+ mycmakeargs+=( |
181 |
+ -DCMAKE_CROSSCOMPILING=ON |
182 |
+ -DCLANG_TABLEGEN=/usr/bin/clang-tblgen |
183 |
+ ) |
184 |
+ fi |
185 |
+ |
186 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
187 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
188 |
+ cmake-utils_src_configure |
189 |
+} |
190 |
+ |
191 |
+multilib_src_compile() { |
192 |
+ cmake-utils_src_compile |
193 |
+ |
194 |
+ # provide a symlink for tests |
195 |
+ if [[ ! -L ${WORKDIR}/lib/clang ]]; then |
196 |
+ mkdir -p "${WORKDIR}"/lib || die |
197 |
+ ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die |
198 |
+ fi |
199 |
+} |
200 |
+ |
201 |
+multilib_src_test() { |
202 |
+ # respect TMPDIR! |
203 |
+ local -x LIT_PRESERVES_TMP=1 |
204 |
+ cmake-utils_src_make check-clang |
205 |
+ multilib_is_native_abi && cmake-utils_src_make check-clang-tools |
206 |
+} |
207 |
+ |
208 |
+src_install() { |
209 |
+ MULTILIB_WRAPPED_HEADERS=( |
210 |
+ /usr/include/clang/Config/config.h |
211 |
+ ) |
212 |
+ |
213 |
+ multilib-minimal_src_install |
214 |
+ |
215 |
+ # Move runtime headers to /usr/lib/clang, where they belong |
216 |
+ mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die |
217 |
+ # move (remaining) wrapped headers back |
218 |
+ mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die |
219 |
+ |
220 |
+ # Apply CHOST and version suffix to clang tools |
221 |
+ # note: we use two version components here (vs 3 in runtime path) |
222 |
+ local llvm_version=$(llvm-config --version) || die |
223 |
+ local clang_version=$(ver_cut 1 "${llvm_version}") |
224 |
+ local clang_full_version=$(ver_cut 1-3 "${llvm_version}") |
225 |
+ local clang_tools=( clang clang++ clang-cl clang-cpp ) |
226 |
+ local abi i |
227 |
+ |
228 |
+ # cmake gives us: |
229 |
+ # - clang-X |
230 |
+ # - clang -> clang-X |
231 |
+ # - clang++, clang-cl, clang-cpp -> clang |
232 |
+ # we want to have: |
233 |
+ # - clang-X |
234 |
+ # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X |
235 |
+ # - clang, clang++, clang-cl, clang-cpp -> clang*-X |
236 |
+ # also in CHOST variant |
237 |
+ for i in "${clang_tools[@]:1}"; do |
238 |
+ rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die |
239 |
+ dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" |
240 |
+ dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" |
241 |
+ done |
242 |
+ |
243 |
+ # now create target symlinks for all supported ABIs |
244 |
+ for abi in $(get_all_abis); do |
245 |
+ local abi_chost=$(get_abi_CHOST "${abi}") |
246 |
+ for i in "${clang_tools[@]}"; do |
247 |
+ dosym "${i}-${clang_version}" \ |
248 |
+ "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" |
249 |
+ dosym "${abi_chost}-${i}-${clang_version}" \ |
250 |
+ "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" |
251 |
+ done |
252 |
+ done |
253 |
+ |
254 |
+ # Remove unnecessary headers on FreeBSD, bug #417171 |
255 |
+ if use kernel_FreeBSD; then |
256 |
+ rm "${ED}"/usr/lib/clang/${clang_full_version}/include/{std,float,iso,limits,tgmath,varargs}*.h || die |
257 |
+ fi |
258 |
+} |
259 |
+ |
260 |
+multilib_src_install() { |
261 |
+ cmake-utils_src_install |
262 |
+ |
263 |
+ # move headers to /usr/include for wrapping & ABI mismatch checks |
264 |
+ # (also drop the version suffix from runtime headers) |
265 |
+ rm -rf "${ED}"/usr/include || die |
266 |
+ mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die |
267 |
+ mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die |
268 |
+} |
269 |
+ |
270 |
+multilib_src_install_all() { |
271 |
+ python_fix_shebang "${ED}" |
272 |
+ if use static-analyzer; then |
273 |
+ python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view |
274 |
+ fi |
275 |
+ |
276 |
+ docompress "/usr/lib/llvm/${SLOT}/share/man" |
277 |
+ # match 'html' non-compression |
278 |
+ use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" |
279 |
+ # +x for some reason; TODO: investigate |
280 |
+ use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" |
281 |
+} |
282 |
+ |
283 |
+pkg_postinst() { |
284 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
285 |
+ eselect compiler-shadow update all |
286 |
+ fi |
287 |
+ |
288 |
+ elog "You can find additional utility scripts in:" |
289 |
+ elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" |
290 |
+ elog "Some of them are vim integration scripts (with instructions inside)." |
291 |
+ elog "The run-clang-tidy.py script requires the following additional package:" |
292 |
+ elog " dev-python/pyyaml" |
293 |
+} |
294 |
+ |
295 |
+pkg_postrm() { |
296 |
+ if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
297 |
+ eselect compiler-shadow clean all |
298 |
+ fi |
299 |
+} |