commit:     cc5382e4b27145aa4b48d35633ecab194c85c630
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  5 15:52:11 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep  5 19:58:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc5382e4

sys-devel/clang-common: Bump to 17.0.0_rc4

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-devel/clang-common/Manifest                    |   2 +
 .../clang-common/clang-common-17.0.0_rc4.ebuild    | 204 +++++++++++++++++++++
 2 files changed, 206 insertions(+)

diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest
index aefca5c7ae38..aa50ad835c53 100644
--- a/sys-devel/clang-common/Manifest
+++ b/sys-devel/clang-common/Manifest
@@ -6,5 +6,7 @@ DIST llvm-project-16.0.6.src.tar.xz 118013488 BLAKE2B 
95192d39cbd2914e5609db3659
 DIST llvm-project-16.0.6.src.tar.xz.sig 566 BLAKE2B 
2060cebd5ed57cb8a86a44238c43dfd4b921649298b10c3d19da308374c1e49869174294e29943c2af459fe06428264e26881d6c1288ebbc48686cc2cf467c7a
 SHA512 
ca249262c7102e0889ec1bdc6f71a3a6f0e7e5d5fbab8abcd6fccd2871e7955eff7af5b055a76006097baf0dfaf2f5069eff3035b3107fc552abdb2481b21447
 DIST llvm-project-17.0.0rc3.src.tar.xz 127805656 BLAKE2B 
ecaead9f227b8357a5dc5ff21554d9b4f5aa036df1b88676fd8c3e16b438381db062872be396af5246e12cd71812a886016e0331a272dafc3508ecd0bfbb50ed
 SHA512 
5f48b4af2e4f9bc470fcfd42fd48072b7bd442bc676d8401b04fbc6e9014a9a78e1bf524ba78f7ae8a1246222a6b03ca662721e3bf6e9eb03a015dd3306c7234
 DIST llvm-project-17.0.0rc3.src.tar.xz.sig 438 BLAKE2B 
7b644cf501d17a6aef9b052e359ba06c1840a75e5263de46d938dbbdea07720b53d7ee6b5861ad641d0f7a7f75c6cc17717847b0ea9cf08873dbfacbe1c19074
 SHA512 
7059b1a90b7dd8cfa831f9e199a3a817358fd75d7c7d7e6de446d5443fce5831877a28e9b964ea238c1d803f9054bf4f53a97622d5f756f7f99aaa1c1a279f44
+DIST llvm-project-17.0.0rc4.src.tar.xz 127838724 BLAKE2B 
e3bf524e55db5e4305099ecdff09c0d3eab7957a5f8729eefe636e361460f405fbfd569af38aa39eea3b6c1e024feaa0400f8bc092194f2c3b54c695e7962591
 SHA512 
be7b5ad136d03864dbd11a589ca9e8b0b04a4226ebcffcc123b3ba72992f704bab4f9550d03eb2ac1d21fb8b73ac7824398b4cb4c9cec2118efb112babfe0f65
+DIST llvm-project-17.0.0rc4.src.tar.xz.sig 438 BLAKE2B 
2cda35b4a3ebddfdbe6828459c8bd8fdfaa8e04d2d1c4f2faf16f5c66909186d2dd73e6a163cf733d8955c007249cf3f62f237855d5a76b1b61f3bfa30e4972d
 SHA512 
5f713e05b7c58fab6e9cc43f2f3f69120482c9b60008146da0cddb266d1a5c9b9a77e1e338fce4e15624b332ac53a90c5c4a6f62c58a77f2122a015b4f0ebed2
 DIST llvm-project-e3373c6c83d3855adb78f1952a3bf0398baf359e.tar.gz 196926975 
BLAKE2B 
9da1052db0a6ff81a8b76cbf9cb2ab7eed5c8798dc5ae6887a4694de8b151c7a1282cfff2da2e8440b1a67d3d12c33db319fbbe6062761b6d5369e6b335821ae
 SHA512 
8bb6d49ddb824e932f7bad3c51e4a6c2227139aaf19c02e9deb15657919bc12ea41844d8fe045061814aefb9031d82b167c7c0c20bedaa09aaffe164a2109f7d
 DIST llvm-project-f6259d9b9a546dbfa5bc2f29313c6edd6c701177.tar.gz 196957045 
BLAKE2B 
c38b17f4e697c090b0b70385e45ca4ce97981746738e556154895d5b57cede90f6b8bdc5f41023bda6e942f07f572aa508cf0107fb81bee80a5ea9f13ac495fd
 SHA512 
8394a42e1963618ed7f7cf7770acb72ae6bf84f3e2351218b5049ea2d76ff6ae768ad5588ffd1b2be1b5228a8fcb03663430814c409ceb9fa5735c891847f816

diff --git a/sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild 
b/sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild
new file mode 100644
index 000000000000..8bca701cfc0b
--- /dev/null
+++ b/sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit bash-completion-r1 llvm.org multilib
+
+DESCRIPTION="Common files shared between multiple slots of clang"
+HOMEPAGE="https://llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA"
+SLOT="0"
+KEYWORDS=""
+IUSE="
+       default-compiler-rt default-libcxx default-lld llvm-libunwind
+       hardened stricter
+"
+
+PDEPEND="
+       sys-devel/clang:*
+       default-compiler-rt? (
+               sys-devel/clang-runtime[compiler-rt]
+               llvm-libunwind? ( sys-libs/llvm-libunwind[static-libs] )
+               !llvm-libunwind? ( sys-libs/libunwind[static-libs] )
+       )
+       !default-compiler-rt? ( sys-devel/gcc )
+       default-libcxx? ( >=sys-libs/libcxx-${PV}[static-libs] )
+       !default-libcxx? ( sys-devel/gcc )
+       default-lld? ( sys-devel/lld )
+       !default-lld? ( sys-devel/binutils )
+"
+IDEPEND="
+       !default-compiler-rt? ( sys-devel/gcc-config )
+       !default-libcxx? ( sys-devel/gcc-config )
+"
+
+LLVM_COMPONENTS=( clang/utils )
+llvm.org_set_globals
+
+pkg_pretend() {
+       [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return
+
+       local flag missing_flags=()
+       for flag in default-{compiler-rt,libcxx,lld}; do
+               if ! use "${flag}" && has_version "sys-devel/clang[${flag}]"; 
then
+                       missing_flags+=( "${flag}" )
+               fi
+       done
+
+       if [[ ${missing_flags[@]} ]]; then
+               eerror "It seems that you have the following flags set on 
sys-devel/clang:"
+               eerror
+               eerror "  ${missing_flags[*]}"
+               eerror
+               eerror "The default runtimes are now set via flags on 
sys-devel/clang-common."
+               eerror "The build is being aborted to prevent breakage.  Please 
either set"
+               eerror "the respective flags on this ebuild, e.g.:"
+               eerror
+               eerror "  sys-devel/clang-common ${missing_flags[*]}"
+               eerror
+               eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1."
+               die "Mismatched defaults detected between sys-devel/clang and 
sys-devel/clang-common"
+       fi
+}
+
+src_install() {
+       newbashcomp bash-autocomplete.sh clang
+
+       insinto /etc/clang
+       newins - gentoo-runtimes.cfg <<-EOF
+               # This file is initially generated by sys-devel/clang-runtime.
+               # It is used to control the default runtimes using by clang.
+
+               --rtlib=$(usex default-compiler-rt compiler-rt libgcc)
+               --unwindlib=$(usex default-compiler-rt libunwind libgcc)
+               --stdlib=$(usex default-libcxx libc++ libstdc++)
+               -fuse-ld=$(usex default-lld lld bfd)
+       EOF
+
+       newins - gentoo-gcc-install.cfg <<-EOF
+               # This file is maintained by gcc-config.
+               # It is used to specify the selected GCC installation.
+       EOF
+
+       newins - gentoo-common.cfg <<-EOF
+               # This file contains flags common to clang, clang++ and 
clang-cpp.
+               @gentoo-runtimes.cfg
+               @gentoo-gcc-install.cfg
+               @gentoo-hardened.cfg
+               # bug #870001
+               -include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h"
+       EOF
+
+       # Baseline hardening (bug #851111)
+       newins - gentoo-hardened.cfg <<-EOF
+               # Some of these options are added unconditionally, regardless of
+               # USE=hardened, for parity with sys-devel/gcc.
+               -fstack-clash-protection
+               -fstack-protector-strong
+               -fPIE
+               -include "${EPREFIX}/usr/include/gentoo/fortify.h"
+
+               -Wl,-z,relro
+       EOF
+
+       dodir /usr/include/gentoo
+
+       cat >> "${ED}/usr/include/gentoo/maybe-stddefs.h" <<-EOF || die
+       /* __has_include is an extension, but it's fine, because this is only
+       for Clang anyway. */
+       #if defined __has_include && __has_include (<stdc-predef.h>) && 
!defined(__GLIBC__)
+       # include <stdc-predef.h>
+       #endif
+       EOF
+
+       local fortify_level=$(usex hardened 3 2)
+       # We have to do this because glibc's headers warn if F_S is set
+       # without optimization and that would at the very least be very noisy
+       # during builds and at worst trigger many -Werror builds.
+       cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die
+       #ifdef __clang__
+       # pragma clang system_header
+       #endif
+       #ifndef _FORTIFY_SOURCE
+       # if defined(__has_feature)
+       #  define __GENTOO_HAS_FEATURE(x) __has_feature(x)
+       # else
+       #  define __GENTOO_HAS_FEATURE(x) 0
+       # endif
+       #
+       # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+       #  if !defined(__SANITIZE_ADDRESS__) && 
!__GENTOO_HAS_FEATURE(address_sanitizer) && 
!__GENTOO_HAS_FEATURE(memory_sanitizer)
+       #   define _FORTIFY_SOURCE ${fortify_level}
+       #  endif
+       # endif
+       # undef __GENTOO_HAS_FEATURE
+       #endif
+       EOF
+
+       if use hardened ; then
+               cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
+                       # Options below are conditional on USE=hardened.
+                       -D_GLIBCXX_ASSERTIONS
+
+                       # Analogue to GLIBCXX_ASSERTIONS
+                       # 
https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
+                       # 
https://libcxx.llvm.org/Hardening.html#using-hardened-mode
+                       -D_LIBCPP_ENABLE_HARDENED_MODE=1
+
+                       -Wl,-z,now
+               EOF
+       fi
+
+       if use stricter; then
+               newins - gentoo-stricter.cfg <<-EOF
+                       # This file increases the strictness of older clang 
versions
+                       # to match the newest upstream version.
+
+                       # clang-16 defaults
+                       -Werror=implicit-function-declaration
+                       -Werror=implicit-int
+                       -Werror=incompatible-function-pointer-types
+
+                       # constructs banned by C2x
+                       -Werror=deprecated-non-prototype
+
+                       # deprecated but large blast radius
+                       #-Werror=strict-prototypes
+               EOF
+
+               cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die
+                       @gentoo-stricter.cfg
+               EOF
+       fi
+
+       # We only install config files for supported ABIs because unprefixed 
tools
+       # might be used for crosscompilation where e.g. PIE may not be 
supported.
+       # See bug #912237 and bug #901247.
+       # Just ${CHOST} won't do due to bug #912685.
+       local abi
+       for abi in $(get_all_abis); do
+               local abi_chost=$(get_abi_CHOST "${abi}")
+
+               local tool
+               for tool in ${abi_chost}-clang{,++,-cpp}; do
+                       newins - "${tool}.cfg" <<-EOF
+                               # This configuration file is used by ${tool} 
driver.
+                               @gentoo-common.cfg
+                       EOF
+               done
+       done
+}
+
+pkg_preinst() {
+       if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc
+       then
+               local gcc_path=$(gcc-config --get-lib-path 2>/dev/null)
+               if [[ -n ${gcc_path} ]]; then
+                       cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF
+                               --gcc-install-dir="${gcc_path%%:*}"
+                       EOF
+               fi
+       fi
+}

Reply via email to