mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-20 22:27:17 -08:00
sys-devel/clang-common: Bump to 17.0.3
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -8,6 +8,8 @@ DIST llvm-project-17.0.1.src.tar.xz 127830376 BLAKE2B bb3b9f7358df9006307f5eeccf
|
||||
DIST llvm-project-17.0.1.src.tar.xz.sig 438 BLAKE2B 3182e3c3a48635fdec39b945ee3b782d7c9c2a07911d9ede2e3421031bb1b4959bd495c5e39d094aeaf555579b9fe3eb834c1449077c154c629f5db605375e7c SHA512 301a6e6c46d6fee13c86dec1a021c35f6bf3a97e5d6b0aa7b7eac34e7ca52f6cefffc25a9e376250b1eb721a65a5852f2f1948abd432698363a81dd7ee19d81c
|
||||
DIST llvm-project-17.0.2.src.tar.xz 127833708 BLAKE2B fa9e2e48ce1117063f5cef0aeef85ce84b99bd8fae23022572a6f016eff2ffbf8aab6250b0bdb6e0bbea1c4daf10cecceb18e80496260b5aa81086075d503e12 SHA512 4586224c3f547e8065fa4f0ca3629a1dfed868dfc372ab192d8b9384f0f74dc8cb27dcb6269dc4230202e6a524aae852d98b40fa02ed0393086a162387ea7659
|
||||
DIST llvm-project-17.0.2.src.tar.xz.sig 438 BLAKE2B 3ba5d7a09e9de3f38a6f7b5b771b08b1c4e96ea7eda948cfa679598d240fa5211fd37220fbe09e37682212b17fb71b8b5539475edb8ff46d9767054983f670cb SHA512 234276813e3f4b5ee9b1dc640a613fd2e60f1d659f4e089733278d08dd0e208ad37d4d64c9e1edd420b6b87e112458ecec5f76ed9a243c3023b0adbab19ab909
|
||||
DIST llvm-project-17.0.3.src.tar.xz 127843636 BLAKE2B 5331d9b545faab282a4caec9ee688d0f1e0615a56a26aa24d8f6fbbae10258e132d94634dab2f7bd69ada06bb28dc899730b9cd774a1086d7c03d5706de6d997 SHA512 44f37dea494a66a83c252e28d7d0517c3b2eed5b196565432dc663c7914bd66d665c8d13479e2776a14cac1905faf6972f986176722c053b58528570a6e68316
|
||||
DIST llvm-project-17.0.3.src.tar.xz.sig 438 BLAKE2B 045e7ca82c8d9b3f182e4fa331ec841b24777ac1888f10de435a389ae3a88172e0559a3fca0c2d37cc874464411ae50d7bc0d0829455149a8de8b953ef6c98c7 SHA512 95f9e6729074cfd71b0ffb21e423cd0fd87763268c24e0513f7afd6a85d08061658c44c03ea3ea3b6e3cc7051676d44c41a791e6905c8abb456d48a3762fc152
|
||||
DIST llvm-project-39fec5457c0925bd39f67f63fe17391584e08258.tar.gz 198361956 BLAKE2B 001b9d9b7997762dcce4f0b1deb94d41c3d840c178ba1e92208782e7e21fdc0041cde359051b2b1b1fc75526ff6504d3b9375ff873831350de359530c944a961 SHA512 b560e71c9855aff9fb5385f9fb30f63fbef074fd695e7cb31847192837a161bfe4808ceb09c514a676ae817616f15fb5a57d325aa9744eaac46b8f4b20b77a13
|
||||
DIST llvm-project-5d35273a32d239b7407338e13ed71b59174d6536.tar.gz 198787569 BLAKE2B 7f4f1eb490028e18826a6ebade649a682e433252ceab1f3dcd9e50c34f24e7ef108c3325ec209a4d4fa1ded8e09ebda4980cb9d8ddce8a0d517923d6c38b8f4a SHA512 4d263561fb12cc07a5e8f7ed2f8f22a3645aa959cf963a6a735a9bb93cfc2a51bf7e4d36b54e8425725029cfcfd868dfcc53af95d26d84be72be124d8c564271
|
||||
DIST llvm-project-f5cb9cb59d7c9c6ac3d5c41c677f68c9b75d34a3.tar.gz 198113948 BLAKE2B 1688920eb790421f4143e92bd7bd26794a2497e7b445dde6d55b59c9df4b1aebb848833c7cb1b7c273c5e002763f2531a341313500ce207242f992dfe343b988 SHA512 9817e8b7adf7c69d673124e8334c3e511dfd1cc386832c52b2fb0f2517475d29cd98513ad87188a962f9697dfac39ea03f5b2db6c549c307cf3d27b1370ffdf3
|
||||
|
||||
@@ -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="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos"
|
||||
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_ASSERTIONS=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
|
||||
}
|
||||
Reference in New Issue
Block a user