summaryrefslogtreecommitdiff
path: root/sys-devel/clang-common
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-10-02 23:47:16 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-10-02 23:47:16 +0100
commitd0855bf65db64f2452deea64fe76e06eaac9987c (patch)
tree42bdcad5ef28a19abde4b7e4ca89410b6b6e420a /sys-devel/clang-common
parent19ad4b65c8b02065c065c91941241f231f78246c (diff)
gentoo auto-resync : 02:10:2023 - 23:47:15
Diffstat (limited to 'sys-devel/clang-common')
-rw-r--r--sys-devel/clang-common/Manifest2
-rw-r--r--sys-devel/clang-common/clang-common-18.0.0_pre20231002.ebuild250
2 files changed, 252 insertions, 0 deletions
diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest
index 2c2c67467cab..67e569e92248 100644
--- a/sys-devel/clang-common/Manifest
+++ b/sys-devel/clang-common/Manifest
@@ -6,6 +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.1.src.tar.xz 127830376 BLAKE2B bb3b9f7358df9006307f5eeccfc5c5ee5497498c4f091347924911cb6534e8d930024c35387456af24bf647d9e24a3d927aa49199036fb475018a610b5d792c7 SHA512 6fc1d5ff4fec49ef5bb495ba9d8f9ee9052c10999ec9d3ac8f825c718e3cdd64abd95408c4e5bb7f67eb9a7bfac9e26d2a949c4da9f163b5646c02e8a670ead5
DIST llvm-project-17.0.1.src.tar.xz.sig 438 BLAKE2B 3182e3c3a48635fdec39b945ee3b782d7c9c2a07911d9ede2e3421031bb1b4959bd495c5e39d094aeaf555579b9fe3eb834c1449077c154c629f5db605375e7c SHA512 301a6e6c46d6fee13c86dec1a021c35f6bf3a97e5d6b0aa7b7eac34e7ca52f6cefffc25a9e376250b1eb721a65a5852f2f1948abd432698363a81dd7ee19d81c
+DIST llvm-project-39fec5457c0925bd39f67f63fe17391584e08258.tar.gz 198361956 BLAKE2B 001b9d9b7997762dcce4f0b1deb94d41c3d840c178ba1e92208782e7e21fdc0041cde359051b2b1b1fc75526ff6504d3b9375ff873831350de359530c944a961 SHA512 b560e71c9855aff9fb5385f9fb30f63fbef074fd695e7cb31847192837a161bfe4808ceb09c514a676ae817616f15fb5a57d325aa9744eaac46b8f4b20b77a13
DIST llvm-project-f5cb9cb59d7c9c6ac3d5c41c677f68c9b75d34a3.tar.gz 198113948 BLAKE2B 1688920eb790421f4143e92bd7bd26794a2497e7b445dde6d55b59c9df4b1aebb848833c7cb1b7c273c5e002763f2531a341313500ce207242f992dfe343b988 SHA512 9817e8b7adf7c69d673124e8334c3e511dfd1cc386832c52b2fb0f2517475d29cd98513ad87188a962f9697dfac39ea03f5b2db6c549c307cf3d27b1370ffdf3
EBUILD clang-common-14.0.6.ebuild 541 BLAKE2B 87b158e874cf600e23591a8095e0edb4d30d4482600ef8fe38984e9ba9559e6e2226107cd482f355d950392a6a452e1a8ae79d297d5afc3951a7f1c8f6227b5f SHA512 1bd0481468c278f131ec9f87243927b60a59752f4229450559bf8016e9599155a52593810fcdc1cf0aecd4aa1529e8df300d95123a53de18eb326152caafbbef
EBUILD clang-common-15.0.7-r5.ebuild 5090 BLAKE2B 39974630209630607d10903585223df68cd809fb390fc9eb2a80c4235ce70ae21120083f8eaf749c769a93f738c4e971e31e978dd637a0b87d07260281db4b83 SHA512 6cb37a7eb373d300d165e851e3643fd35e11d78a6a88617b4a8c0063b83558d10d307c32861e9ba2d0ac902c1cd2069ece6bd1446e309a6753f13adf8cd8fa2c
@@ -15,4 +16,5 @@ EBUILD clang-common-17.0.1.ebuild 7403 BLAKE2B 35f5e2902195de83791905633e996ae12
EBUILD clang-common-17.0.2.9999.ebuild 7312 BLAKE2B f4b71b9e945ab3077cc6a878db875b42fe5af5eea1a60e440d32084ec50de0d86bcb68f4abda1316cf662a077e2f21330a88a7bc82e629c68062c7ebf6fa3ef6 SHA512 3072535b554289d422363d67c91416b54d007c0ff6f67b7311c558d14ab9201f02b71ad629c872db6fe44b648b44736c412bb6c63f495d4d4ab682f71ca919ea
EBUILD clang-common-18.0.0.9999.ebuild 7315 BLAKE2B 00a7319ea073ee22b56e5299c97c083444fffaa8739fa420c79368fd5c6217c3333b616a7c347276797baef3a586069c879f08061cd01c2b73e222b779d74928 SHA512 6948e83aab799aec9835d11cbef96809cc0d4e9205a8b49770dab92ca0f9430989130e553ef56263dd5362e9419e7f2c1945987f538ebe212112b504fe04ff35
EBUILD clang-common-18.0.0_pre20230925.ebuild 7315 BLAKE2B 00a7319ea073ee22b56e5299c97c083444fffaa8739fa420c79368fd5c6217c3333b616a7c347276797baef3a586069c879f08061cd01c2b73e222b779d74928 SHA512 6948e83aab799aec9835d11cbef96809cc0d4e9205a8b49770dab92ca0f9430989130e553ef56263dd5362e9419e7f2c1945987f538ebe212112b504fe04ff35
+EBUILD clang-common-18.0.0_pre20231002.ebuild 7315 BLAKE2B 00a7319ea073ee22b56e5299c97c083444fffaa8739fa420c79368fd5c6217c3333b616a7c347276797baef3a586069c879f08061cd01c2b73e222b779d74928 SHA512 6948e83aab799aec9835d11cbef96809cc0d4e9205a8b49770dab92ca0f9430989130e553ef56263dd5362e9419e7f2c1945987f538ebe212112b504fe04ff35
MISC metadata.xml 735 BLAKE2B 12ea133df3d7eb9367a65e572ef91893e654d5b77caa27c66e4b5b41ba90ebc5e619eb78dfff2a67183d2c1cbfcf35fa903b2bb75604ce153d5cedfce5346e3c SHA512 8ed6b12d4f2aa1985897a8d81ce898dbc0d14ac222f3d0f259cbe80fbb8b2349dff7677627daeaf39a422f290200da4fac6348abc81c9e35da0ca73a11cfdd83
diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20231002.ebuild b/sys-devel/clang-common/clang-common-18.0.0_pre20231002.ebuild
new file mode 100644
index 000000000000..baa1dffade6a
--- /dev/null
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20231002.ebuild
@@ -0,0 +1,250 @@
+# 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
+}
+
+doclang_cfg() {
+ local triple="${1}"
+
+ local tool
+ for tool in ${triple}-clang{,++}; do
+ newins - "${tool}.cfg" <<-EOF
+ # This configuration file is used by ${tool} driver.
+ @gentoo-common.cfg
+ @gentoo-common-ld.cfg
+ EOF
+ done
+
+ newins - "${triple}-clang-cpp.cfg" <<-EOF
+ # This configuration file is used by the ${triple}-clang-cpp driver.
+ @gentoo-common.cfg
+ EOF
+
+ # Install symlinks for triples with other vendor strings since some
+ # programs insist on mangling the triple.
+ local vendor
+ for vendor in gentoo pc unknown; do
+ local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
+ for tool in clang{,++,-cpp}; do
+ if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then
+ dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg"
+ fi
+ done
+ done
+}
+
+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
+
+ # clang-cpp does not like link args being passed to it when directly
+ # invoked, so use a separate configuration file.
+ newins - gentoo-common-ld.cfg <<-EOF
+ # This file contains flags common to clang and clang++
+ @gentoo-hardened-ld.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
+
+ newins - gentoo-hardened-ld.cfg <<-EOF
+ # Some of these options are added unconditionally, regardless of
+ # USE=hardened, for parity with sys-devel/gcc.
+ -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(__STDC_HOSTED__) && __STDC_HOSTED__ == 1
+ # define __GENTOO_NOT_FREESTANDING 1
+ # else
+ # define __GENTOO_NOT_FREESTANDING 0
+ # endif
+ #
+ # if defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && __GENTOO_NOT_FREESTANDING > 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
+ # undef __GENTOO_NOT_FREESTANDING
+ #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
+ EOF
+
+ cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
+ # Options below are conditional on USE=hardened.
+ -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.
+ doclang_cfg "${CHOST}"
+
+ # 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}")
+ doclang_cfg "${abi_chost}"
+ 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
+}