commit:     6b1ae97670d8c59024622c3ac390abe9a07647c5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 21 12:17:53 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Apr 21 17:15:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b1ae976

sys-devel/clang-common: Add 17.0.0_pre20230421 snapshot

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

 sys-devel/clang-common/Manifest                    |   1 +
 .../clang-common-17.0.0_pre20230421.ebuild         | 180 +++++++++++++++++++++
 2 files changed, 181 insertions(+)

diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest
index e79e1260419a..ea6be99832d1 100644
--- a/sys-devel/clang-common/Manifest
+++ b/sys-devel/clang-common/Manifest
@@ -8,3 +8,4 @@ DIST llvm-project-16.0.1.src.tar.xz.sig 566 BLAKE2B 
06c03d789e63ab30bba4c56ba9ec
 DIST llvm-project-16.0.2.src.tar.xz 117995768 BLAKE2B 
b329b2b123428f3a966a96f074a75520f07d12fc13ec755403cff2346b23195e6a0c05ca9e789b4cf5b4b3557a922bd41d8dffb6056ee33fbbf2b81001511fae
 SHA512 
4ca76aaaca8812a06a94071e7444a3213d85dca51ea86f6125f854776f69a3e088a92d0621e3911e526f280b35bfb778fb3742c6010d3ed1eba605c08720377c
 DIST llvm-project-16.0.2.src.tar.xz.sig 566 BLAKE2B 
8243748ac27e4eec3cc011371e179e19f1005336f07d956fd358f649d1429c8d0ea22ecc376b1dec9fe3db971467ad1dd63e97bb089885d0e1994eeab26b6fd7
 SHA512 
dbe9367a259954a38f2369b2f226726162090227f1a5ae8c8809eaae47cad7b3b26c754633e6e5c54cacd6360a504d7ba4c659d9232c1648388d657a2aaad10c
 DIST llvm-project-5c60a08c696c0420ddc5fdad5b8e50a7528cb3bf.tar.gz 182291041 
BLAKE2B 
f5997611e0293df515d4494d14895cc8fbe22b536f5c419e4ad7d098acbf2b1046ceb332d865eacdae0b7fa1a77b78090551976835dd1b95b5270c9f6e12e410
 SHA512 
6cda8e55b4fc70e94838c772c56213c811affda96fb98a03d432348f995a313447d0e0e84533350e1fda3162d82633b260ccd8e3b1d59d3216187b44dc5556fb
+DIST llvm-project-5ea158077ec9ca50857ede5cbb0b27c61663fd55.tar.gz 182543024 
BLAKE2B 
32f5a9ddaa6c7e283d97256d7bd68634f2f8ed6d7167e743ba8076809ea1a3a7159f9ccc56a6e5a8838481cade07389669d8a35b17b5922da0cbef04c80131f8
 SHA512 
3d180c04ef39adbc9c6ee485e21cdf63fde362f0a22026b00a6d3eba6243e4c8e96fc088335f31051e54f4546d62569131a671d2e655ea735d597361f5732827

diff --git a/sys-devel/clang-common/clang-common-17.0.0_pre20230421.ebuild 
b/sys-devel/clang-common/clang-common-17.0.0_pre20230421.ebuild
new file mode 100644
index 000000000000..5b4a6647f3ca
--- /dev/null
+++ b/sys-devel/clang-common/clang-common-17.0.0_pre20230421.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit bash-completion-r1 llvm.org
+
+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} )
+       !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
+       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"
+       EOF
+
+       dodir /usr/include/gentoo
+
+       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
+                       -D_LIBCPP_ENABLE_ASSERTIONS=1
+               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
+
+       local tool
+       for tool in clang{,++,-cpp}; do
+               newins - "${tool}.cfg" <<-EOF
+                       # This configuration file is used by ${tool} driver.
+                       @gentoo-common.cfg
+               EOF
+       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