From e5558bb40ba46b03d0c8e82ae60dce9a32933989 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 27 Mar 2024 07:01:35 +0000 Subject: gentoo auto-resync : 27:03:2024 - 07:01:35 --- sys-devel/Manifest.gz | Bin 7708 -> 7704 bytes sys-devel/clang-common/Manifest | 16 +- .../clang-common/clang-common-15.0.7-r7.ebuild | 185 ------------- .../clang-common/clang-common-15.0.7-r8.ebuild | 4 +- .../clang-common/clang-common-16.0.6-r2.ebuild | 191 ------------- .../clang-common/clang-common-16.0.6-r3.ebuild | 191 ------------- .../clang-common/clang-common-16.0.6-r4.ebuild | 191 +++++++++++++ .../clang-common/clang-common-17.0.6-r1.ebuild | 289 -------------------- .../clang-common/clang-common-17.0.6-r3.ebuild | 295 -------------------- .../clang-common/clang-common-17.0.6-r4.ebuild | 295 ++++++++++++++++++++ .../clang-common/clang-common-18.1.2-r2.ebuild | 297 --------------------- .../clang-common/clang-common-18.1.2-r3.ebuild | 297 +++++++++++++++++++++ sys-devel/clang-common/clang-common-18.1.2.ebuild | 291 -------------------- .../clang-common/clang-common-19.0.0.9999.ebuild | 2 +- .../clang-common-19.0.0_pre20240322-r1.ebuild | 2 +- 15 files changed, 793 insertions(+), 1753 deletions(-) delete mode 100644 sys-devel/clang-common/clang-common-15.0.7-r7.ebuild delete mode 100644 sys-devel/clang-common/clang-common-16.0.6-r2.ebuild delete mode 100644 sys-devel/clang-common/clang-common-16.0.6-r3.ebuild create mode 100644 sys-devel/clang-common/clang-common-16.0.6-r4.ebuild delete mode 100644 sys-devel/clang-common/clang-common-17.0.6-r1.ebuild delete mode 100644 sys-devel/clang-common/clang-common-17.0.6-r3.ebuild create mode 100644 sys-devel/clang-common/clang-common-17.0.6-r4.ebuild delete mode 100644 sys-devel/clang-common/clang-common-18.1.2-r2.ebuild create mode 100644 sys-devel/clang-common/clang-common-18.1.2-r3.ebuild delete mode 100644 sys-devel/clang-common/clang-common-18.1.2.ebuild (limited to 'sys-devel') diff --git a/sys-devel/Manifest.gz b/sys-devel/Manifest.gz index 54495a68f214..535db90a6d81 100644 Binary files a/sys-devel/Manifest.gz and b/sys-devel/Manifest.gz differ diff --git a/sys-devel/clang-common/Manifest b/sys-devel/clang-common/Manifest index 75768c180aed..269e5916df4b 100644 --- a/sys-devel/clang-common/Manifest +++ b/sys-devel/clang-common/Manifest @@ -8,15 +8,11 @@ DIST llvm-project-18.1.2.src.tar.xz 132060436 BLAKE2B f21fca02fe9e02a3d440595aaf DIST llvm-project-18.1.2.src.tar.xz.sig 566 BLAKE2B 97c6b6b4a041316e70abd54ff715d87a62410fe5590c9b90548fff5a5121d8d5e028ec681f7e99c130d6c6726835365825286ef0a01c82a98394d9369ea7a390 SHA512 1cd8d1c227782cb43e269696045cea500a43f3c6b786f2cda8d380f5b8fc28d3ada11c41c4a252f2d3db465f767b27ea50c5659faa43d4aa5655cc3ffd6243c2 DIST llvm-project-6d3cec01a6c29fa4e51ba129fa13dbf55d2b928e.tar.gz 207700152 BLAKE2B 855720b7a9cc7b1d8fdf398394eb5c702dd615c04e7dad51c449cb1c2f46e75f2ccf2ee10fa3a3403d6aec29f557023a11bd8cdb525bc9c3d76c79f23cd15e82 SHA512 ff6269158e165907c69bd3e4d2d6b87b4f4670546b7e290d7e6665e7097ec887d71174fa37bf5e1755524317e8ae8f0c7c7e428049e8b553faa52c614f1f4490 DIST llvm-project-f3cfe016c5d8429c0dccfa6f85442e2ea0d45a58.tar.gz 208184654 BLAKE2B abd35798f7c921866bb221cecc42aa94915271d0804acbf44dbe5640efb787ef9d928c329eacde768fac4292217ed4d3c4187fba02dd1c826059aeaa1bad33f0 SHA512 513f7278367114ba3fe3271e8a790b62adbca97d280968537e44e5df9a7afb467a5ca93480f4d4fb7c4d5c0734d00ab54559bf68c00f09a1fcff2fee492aa84f -EBUILD clang-common-15.0.7-r7.ebuild 5462 BLAKE2B 098697c65115e672a1e878167997d820c93cad6a71c5a1dc17c731a031d37f20e50ef41e2f1d3238bc91065ba23bab5db4ab48e8274be9db3cb086ec6cdf7868 SHA512 7500bf0c4fde82b90aac68d09b95a49c241fae8b0d2340f7780e9baed1c85d855e45c4296a7daaa0b831a07f442e0be4faf6510a335fa5c979b3061e28fdb99d -EBUILD clang-common-15.0.7-r8.ebuild 5481 BLAKE2B 581f6dcec8a01aef5d8121bc4051bfea0f1b414cb277fcb6ad750472662dd0a1597f048772c33a3e2f72f4f500f4b4f185b03460b2e7ace3b14a2ad22ae5be23 SHA512 49878c9bac0ea61b009863f45f0ee28a55c0937f49a0c91e4b9c9c884b5a3a9a3fa4128b049631304c31ad809a7d275bf992498f2736e64d78027c1a2f8addc0 -EBUILD clang-common-16.0.6-r2.ebuild 5694 BLAKE2B 18498071d0ca64d58e19ba1e11a42aa7bdf630f66b30aa80e4b72a9aa69f45723baea1da53462cb351075481ad1500544fbb3243ffd8aec16c04c526e2844723 SHA512 70736fa50d37a505b41b385ed0ecd5bca571e1a04d9bc66dfb010e5e1ab61aadaf26bdec17bb46d7a7850dcb90cbabdb173887c0f93fe94c78a460784bc04ab8 -EBUILD clang-common-16.0.6-r3.ebuild 5725 BLAKE2B fef6abf4d29c76572e1598efccb4c7cf32e1238b2cea63d5d01c83e057d52baa82ff70abcacad84121edaf5c06777ee4b13daf40bc57e221e7c3cabd0c3820b7 SHA512 bac47f80fedeeb88394f126a3393e94dba8cd9f464b446e0d8291d444c44d4879afb6db23c29404978ac6b84a8b2c4be7c3c334b3fbb5c9fb7712ab63effe0db -EBUILD clang-common-17.0.6-r1.ebuild 8629 BLAKE2B 37c71ff17e805407826bd6ac8e040820c041b37754b9bc55ee67b9ff75bbc993cb4903f9d4018bfda5e37e7dd6d42ac2ea6e16c17a6f369d2fa3862da9607a79 SHA512 d6c8e2731cf29263cd1f17fd90257e9cd9bff372afa1e35f652197c3691ce879794b840a930c02b1ff394dac39d016f6362a86d4938740a65ef084d2ee4b5147 -EBUILD clang-common-17.0.6-r3.ebuild 8809 BLAKE2B b8f534730118e3553b3c02065da860b73608fc63a4e89090d3115afde69bdb590af4ab3d9218a7f19b55e13cb719992be7d3d643572ce7cb779aa362279b743f SHA512 7a5a8ca6c301e9a1bcefb0b4af014af1d41f77dc622a89075b6aac3413bf077f7e65f4ed6fba066e839fd1d94a7e9e7e306bf3ff7d0d3960f44cf43bcba190a1 -EBUILD clang-common-18.1.2-r2.ebuild 8926 BLAKE2B a14c560cede33e7aa1fc0b8b5d56c4ec15f0fc5f6675a192463223644fa444fb27ec49b30ddc405e618425505cff781c91a6d8ff833e332350030ecd93d79981 SHA512 8a01f5d53029bb993f5671dc95b82ed91a8daaf586f2cb53e1c4e050ff24888616d8d22f7028dee0b9c01422cc1103cfd83c1d1ad57b61df202e4b9579475eb0 -EBUILD clang-common-18.1.2.ebuild 8753 BLAKE2B 562cd03f515472d69eb0be89030066863ec8de6525420eeffab8388241f1d2a4896ec62df754dad5edf7d79061878019d6425cf6c433a27a8b2d69ef0db8f72b SHA512 1ad9a3c60a9d63aa0051e9bfba12c7d5596f443924c1afc122f8c47701f6bcd7109d663596faf284924fd117f80a97ec592ab8465beda03bd9c20a963376946a -EBUILD clang-common-19.0.0.9999.ebuild 8810 BLAKE2B 48a14a93dcbbafd4a2cd62705c4c05bde2bc8c94e6bcc7455e401b0ce7e01bb3534beac8a84f865f66dff94a8c63f2113e468b09daa998f28d7bfa7542977a80 SHA512 0f34ca4bf18f937ca60be571dc14f8ae06ef5ba269c251e0f391f202b683070d7a96d76aa4df84e01f03a5be886cea82beee9f9fa4fb304aa0a258f20df0c597 +EBUILD clang-common-15.0.7-r8.ebuild 5482 BLAKE2B 20e8744166a852b4dbc233f128807e60bb204f14558d2cc1691b1a87777be2775d1a6c82a108945f795b02919bc47bf213b1a85e45f423c49a6009aed0fbbc3b SHA512 bf1f5cdf47c6772266117e9545994dcfb27cfd263a5e7749604106686d8e56b8b45ddab7073d6baf73e966304162f3aad755075c11dbb16bb42b88fa78e6face +EBUILD clang-common-16.0.6-r4.ebuild 5726 BLAKE2B de26b88570bf487a2be2a59f4551c8e61b940fb84b0dc3cb5be1884252672782700b657fb63c0b7ac247ec2092b236a550b51273f73ec19fab7db6eeda0ff94e SHA512 9f2778fbb89d578e162b36c7a692219533437d9fbec407422e7aff1b11d942f09c8cf0edb5c5bd37bbf34523b1f947b418f954b632d769f836baa7d2493bc527 +EBUILD clang-common-17.0.6-r4.ebuild 8810 BLAKE2B 2199235423b02265cbc9430d5d3c846262a5fccd77fad72b45baf3b37485423114401166213017d7e5a15737a49c0272eeb949dac4962640bfaff42dbe4ca4b4 SHA512 d54caa931a4ba43f9aeb68cf35e41ed608cd71ef9519454939fba58ed5089884eb014c138d58f409789f5503f0f809cda4eb9c9d95e2e20e936f532a76b4095b +EBUILD clang-common-18.1.2-r3.ebuild 8934 BLAKE2B a77b12fbdaf06369d9d59dd00470053d500572bccb209a59b634ea4685e28ece1b0ac50e7bed0f025ab08697ea91efac191823ad3419888628430332c8175d5c SHA512 4b4e1f0f1a947c127f2ad3e84df09c9309e3df9b5733f0a3f9b25473314823af9f976803830d4b2d1aa7611712fb77a0cf5536a10bd5aab2965705ff201e0d09 +EBUILD clang-common-19.0.0.9999.ebuild 8818 BLAKE2B 9f473287ff21b7947cd7b04024a568a03c5bebb334c6686a3d132c9b3a84f58e3b4e7a6d5432b8ea5eaaf29aa835d7acb705a1da32551fae49c3ba69a230cfb9 SHA512 96e5b3ae98b6b9d8d42df764effa8dd4d59000d8ae2899163169723d15d2fa891ff5ae9d6cefdec60f13fdbf58368714c5cac8ed93dd7de80fe594158f89a2dc EBUILD clang-common-19.0.0_pre20240316.ebuild 8774 BLAKE2B 441c37d7db6d4964fe8427af6631f4cdac92df372e66a4b43ea3558c153965152b060f1acef91f230f5a6e23fac08116bb09129cd1ee23ec0ecc636e332ef8d1 SHA512 29944fc4c718ddf998474b62f9022ac1505b9b4c011a0e957a2de6c801ccbf4b77d7c39a005cb8f310c51afb6b2f3fa7c99e9b408549f00146bced5883a2a1dd -EBUILD clang-common-19.0.0_pre20240322-r1.ebuild 8810 BLAKE2B 48a14a93dcbbafd4a2cd62705c4c05bde2bc8c94e6bcc7455e401b0ce7e01bb3534beac8a84f865f66dff94a8c63f2113e468b09daa998f28d7bfa7542977a80 SHA512 0f34ca4bf18f937ca60be571dc14f8ae06ef5ba269c251e0f391f202b683070d7a96d76aa4df84e01f03a5be886cea82beee9f9fa4fb304aa0a258f20df0c597 +EBUILD clang-common-19.0.0_pre20240322-r1.ebuild 8818 BLAKE2B 9f473287ff21b7947cd7b04024a568a03c5bebb334c6686a3d132c9b3a84f58e3b4e7a6d5432b8ea5eaaf29aa835d7acb705a1da32551fae49c3ba69a230cfb9 SHA512 96e5b3ae98b6b9d8d42df764effa8dd4d59000d8ae2899163169723d15d2fa891ff5ae9d6cefdec60f13fdbf58368714c5cac8ed93dd7de80fe594158f89a2dc MISC metadata.xml 1248 BLAKE2B d9c542ec74a08857a87a42927feef909c343b5b672145e471ebc69753a3f93432d2ae93ed2659a67d504e2c5ff4212640e4208b173d96e5a173a1043766b66f8 SHA512 eb6d4be1dfbdf6b70b774d42493f6b3015472d5e4bba9386254f6e4ae92307169fe1ac6f0f613d452a9c21c6d61ed57ab50efb54813146983f4d6809b32ddacb diff --git a/sys-devel/clang-common/clang-common-15.0.7-r7.ebuild b/sys-devel/clang-common/clang-common-15.0.7-r7.ebuild deleted file mode 100644 index 7d9a04e76075..000000000000 --- a/sys-devel/clang-common/clang-common-15.0.7-r7.ebuild +++ /dev/null @@ -1,185 +0,0 @@ -# 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="amd64 arm arm64 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 -} - -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) - # (-fstack-clash-protection is omitted because of a possible Clang bug, - # see bug #892537 and bug #865339.) - newins - gentoo-hardened.cfg <<-EOF - # Some of these options are added unconditionally, regardless of - # USE=hardened, for parity with sys-devel/gcc. - -fstack-protector-strong - -fPIE - -include "${EPREFIX}/usr/include/gentoo/fortify.h" - 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 () && !defined(__GLIBC__) - # include - #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 - -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 - 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 -} diff --git a/sys-devel/clang-common/clang-common-15.0.7-r8.ebuild b/sys-devel/clang-common/clang-common-15.0.7-r8.ebuild index ddefc1b716bb..4d200fba7af7 100644 --- a/sys-devel/clang-common/clang-common-15.0.7-r8.ebuild +++ b/sys-devel/clang-common/clang-common-15.0.7-r8.ebuild @@ -10,7 +10,7 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos" +KEYWORDS="amd64 arm arm64 ppc ppc64 ~riscv sparc x86 ~amd64-linux ~ppc-macos ~x64-macos" IUSE=" default-compiler-rt default-libcxx default-lld llvm-libunwind hardened stricter @@ -26,7 +26,7 @@ PDEPEND=" !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/lld-${PV} ) !default-lld? ( sys-devel/binutils ) " IDEPEND=" diff --git a/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild b/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild deleted file mode 100644 index a118a00dae9b..000000000000 --- a/sys-devel/clang-common/clang-common-16.0.6-r2.ebuild +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright 1999-2024 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="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86 ~amd64-linux ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix hardened llvm-libunwind -" - -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" - 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 () && !defined(__GLIBC__) - # include - #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 - -D_LIBCPP_ENABLE_ASSERTIONS=1 - 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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - cat >> "${ED}/etc/clang/clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-16.0.6-r3.ebuild b/sys-devel/clang-common/clang-common-16.0.6-r3.ebuild deleted file mode 100644 index 2b4f5f8e714b..000000000000 --- a/sys-devel/clang-common/clang-common-16.0.6-r3.ebuild +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright 1999-2024 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="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix hardened llvm-libunwind -" - -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. - -Xarch_host -fstack-clash-protection - -Xarch_host -fstack-protector-strong - -fPIE - -include "${EPREFIX}/usr/include/gentoo/fortify.h" - 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 () && !defined(__GLIBC__) - # include - #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 - -D_LIBCPP_ENABLE_ASSERTIONS=1 - 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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - cat >> "${ED}/etc/clang/clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-16.0.6-r4.ebuild b/sys-devel/clang-common/clang-common-16.0.6-r4.ebuild new file mode 100644 index 000000000000..8185d75d346e --- /dev/null +++ b/sys-devel/clang-common/clang-common-16.0.6-r4.ebuild @@ -0,0 +1,191 @@ +# Copyright 1999-2024 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="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86 ~amd64-linux ~arm64-macos ~ppc-macos ~x64-macos" +IUSE=" + default-compiler-rt default-libcxx default-lld + bootstrap-prefix hardened llvm-libunwind +" + +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-${PV} ) + !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. + -Xarch_host -fstack-clash-protection + -Xarch_host -fstack-protector-strong + -fPIE + -include "${EPREFIX}/usr/include/gentoo/fortify.h" + 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 () && !defined(__GLIBC__) + # include + #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 + -D_LIBCPP_ENABLE_ASSERTIONS=1 + 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 + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + # Gentoo Prefix on Darwin + -Wl,-search_paths_first + -Wl,-rpath,${EPREFIX}/usr/lib + -L ${EPREFIX}/usr/lib + -isystem ${EPREFIX}/usr/include + -isysroot ${EPREFIX}/MacOSX.sdk + EOF + if use bootstrap-prefix ; then + # bootstrap-prefix is only set during stage2 of bootstrapping + # Prefix, where EPREFIX is set to EPREFIX/tmp. + # Here we need to point it at the future lib dir of the stage3's + # EPREFIX. + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + -Wl,-rpath,${EPREFIX}/../usr/lib + EOF + fi + cat >> "${ED}/etc/clang/clang++.cfg" <<-EOF || die + -lc++abi + EOF + fi +} + +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 +} diff --git a/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild b/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild deleted file mode 100644 index 233d275883b1..000000000000 --- a/sys-devel/clang-common/clang-common-17.0.6-r1.ebuild +++ /dev/null @@ -1,289 +0,0 @@ -# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix hardened llvm-libunwind -" - -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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi - - 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 -} - -doclang_cfg() { - local triple="${1}" - - _doclang_cfg ${triple} - - # LLVM may have different arch names in some cases. For example in x86 - # profiles the triple uses i686, but llvm will prefer i386 if invoked - # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will - # be used if invoked through ${CHOST}-clang{,++,-cpp} though. - # - # To make sure the correct triples are installed, - # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp - # and compare with CHOST values in profiles. - - local abi=${triple%%-*} - case ${abi} in - armv4l|armv4t|armv5tel|armv6j|armv7a) - _doclang_cfg ${triple/${abi}/arm} - ;; - i686) - _doclang_cfg ${triple/${abi}/i386} - ;; - sparc) - _doclang_cfg ${triple/${abi}/sparcel} - ;; - sparc64) - _doclang_cfg ${triple/${abi}/sparcv9} - ;; - esac -} - -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 - - if use kernel_Darwin; then - newins - gentoo-hardened-ld.cfg <<-EOF - # There was -Wl,-z,relro here, but it's not supported on Mac - # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job - EOF - else - 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 - fi - - 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 () && !defined(__GLIBC__) - # include - #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 - - # 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}") - doclang_cfg "${abi_chost}" - done - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-17.0.6-r3.ebuild b/sys-devel/clang-common/clang-common-17.0.6-r3.ebuild deleted file mode 100644 index f6796cb95d4e..000000000000 --- a/sys-devel/clang-common/clang-common-17.0.6-r3.ebuild +++ /dev/null @@ -1,295 +0,0 @@ -# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix cet hardened llvm-libunwind -" - -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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi - - 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 -} - -doclang_cfg() { - local triple="${1}" - - _doclang_cfg ${triple} - - # LLVM may have different arch names in some cases. For example in x86 - # profiles the triple uses i686, but llvm will prefer i386 if invoked - # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will - # be used if invoked through ${CHOST}-clang{,++,-cpp} though. - # - # To make sure the correct triples are installed, - # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp - # and compare with CHOST values in profiles. - - local abi=${triple%%-*} - case ${abi} in - armv4l|armv4t|armv5tel|armv6j|armv7a) - _doclang_cfg ${triple/${abi}/arm} - ;; - i686) - _doclang_cfg ${triple/${abi}/i386} - ;; - sparc) - _doclang_cfg ${triple/${abi}/sparcel} - ;; - sparc64) - _doclang_cfg ${triple/${abi}/sparcv9} - ;; - esac -} - -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. - -Xarch_host -fstack-clash-protection - -Xarch_host -fstack-protector-strong - -fPIE - -include "${EPREFIX}/usr/include/gentoo/fortify.h" - EOF - - if use amd64; then - cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die - -Xarch_host -fcf-protection=$(usex cet full none) - EOF - fi - - if use kernel_Darwin; then - newins - gentoo-hardened-ld.cfg <<-EOF - # There was -Wl,-z,relro here, but it's not supported on Mac - # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job - EOF - else - 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 - -Wl,-z,now - EOF - fi - - 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 () && !defined(__GLIBC__) - # include - #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. - 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}") - doclang_cfg "${abi_chost}" - done - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-17.0.6-r4.ebuild b/sys-devel/clang-common/clang-common-17.0.6-r4.ebuild new file mode 100644 index 000000000000..f152ec3f96ec --- /dev/null +++ b/sys-devel/clang-common/clang-common-17.0.6-r4.ebuild @@ -0,0 +1,295 @@ +# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" +IUSE=" + default-compiler-rt default-libcxx default-lld + bootstrap-prefix cet hardened llvm-libunwind +" + +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-${PV} ) + !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 + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die + -lc++abi + EOF + fi + + 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 +} + +doclang_cfg() { + local triple="${1}" + + _doclang_cfg ${triple} + + # LLVM may have different arch names in some cases. For example in x86 + # profiles the triple uses i686, but llvm will prefer i386 if invoked + # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will + # be used if invoked through ${CHOST}-clang{,++,-cpp} though. + # + # To make sure the correct triples are installed, + # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp + # and compare with CHOST values in profiles. + + local abi=${triple%%-*} + case ${abi} in + armv4l|armv4t|armv5tel|armv6j|armv7a) + _doclang_cfg ${triple/${abi}/arm} + ;; + i686) + _doclang_cfg ${triple/${abi}/i386} + ;; + sparc) + _doclang_cfg ${triple/${abi}/sparcel} + ;; + sparc64) + _doclang_cfg ${triple/${abi}/sparcv9} + ;; + esac +} + +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. + -Xarch_host -fstack-clash-protection + -Xarch_host -fstack-protector-strong + -fPIE + -include "${EPREFIX}/usr/include/gentoo/fortify.h" + EOF + + if use amd64; then + cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die + -Xarch_host -fcf-protection=$(usex cet full none) + EOF + fi + + if use kernel_Darwin; then + newins - gentoo-hardened-ld.cfg <<-EOF + # There was -Wl,-z,relro here, but it's not supported on Mac + # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job + EOF + else + 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 + -Wl,-z,now + EOF + fi + + 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 () && !defined(__GLIBC__) + # include + #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. + 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}") + doclang_cfg "${abi_chost}" + done + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + # Gentoo Prefix on Darwin + -Wl,-search_paths_first + -Wl,-rpath,${EPREFIX}/usr/lib + -L ${EPREFIX}/usr/lib + -isystem ${EPREFIX}/usr/include + -isysroot ${EPREFIX}/MacOSX.sdk + EOF + if use bootstrap-prefix ; then + # bootstrap-prefix is only set during stage2 of bootstrapping + # Prefix, where EPREFIX is set to EPREFIX/tmp. + # Here we need to point it at the future lib dir of the stage3's + # EPREFIX. + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + -Wl,-rpath,${EPREFIX}/../usr/lib + EOF + fi + fi +} + +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 +} diff --git a/sys-devel/clang-common/clang-common-18.1.2-r2.ebuild b/sys-devel/clang-common/clang-common-18.1.2-r2.ebuild deleted file mode 100644 index 986593dfbbc2..000000000000 --- a/sys-devel/clang-common/clang-common-18.1.2-r2.ebuild +++ /dev/null @@ -1,297 +0,0 @@ -# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix cet hardened llvm-libunwind -" - -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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi - - 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 -} - -doclang_cfg() { - local triple="${1}" - - _doclang_cfg ${triple} - - # LLVM may have different arch names in some cases. For example in x86 - # profiles the triple uses i686, but llvm will prefer i386 if invoked - # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will - # be used if invoked through ${CHOST}-clang{,++,-cpp} though. - # - # To make sure the correct triples are installed, - # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp - # and compare with CHOST values in profiles. - - local abi=${triple%%-*} - case ${abi} in - armv4l|armv4t|armv5tel|armv6j|armv7a) - _doclang_cfg ${triple/${abi}/arm} - ;; - i686) - _doclang_cfg ${triple/${abi}/i386} - ;; - sparc) - _doclang_cfg ${triple/${abi}/sparcel} - ;; - sparc64) - _doclang_cfg ${triple/${abi}/sparcv9} - ;; - esac -} - -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. - -Xarch_host -fstack-clash-protection - -Xarch_host -fstack-protector-strong - -fPIE - -include "${EPREFIX}/usr/include/gentoo/fortify.h" - EOF - - if use amd64; then - cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die - -Xarch_host -fcf-protection=$(usex cet full none) - EOF - fi - - if use kernel_Darwin; then - newins - gentoo-hardened-ld.cfg <<-EOF - # There was -Wl,-z,relro here, but it's not supported on Mac - # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job - EOF - else - 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 - -Wl,-z,now - EOF - fi - - 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 () && !defined(__GLIBC__) - # include - #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 - - # TODO: Maybe -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST for - # non-hardened? - 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE - EOF - - cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die - # Options below are conditional on USE=hardened. - 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}") - doclang_cfg "${abi_chost}" - done - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-18.1.2-r3.ebuild b/sys-devel/clang-common/clang-common-18.1.2-r3.ebuild new file mode 100644 index 000000000000..fff63838526d --- /dev/null +++ b/sys-devel/clang-common/clang-common-18.1.2-r3.ebuild @@ -0,0 +1,297 @@ +# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" +IUSE=" + default-compiler-rt default-libcxx default-lld + bootstrap-prefix cet hardened llvm-libunwind +" + +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-${PV} ) + !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 + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die + -lc++abi + EOF + fi + + 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 +} + +doclang_cfg() { + local triple="${1}" + + _doclang_cfg ${triple} + + # LLVM may have different arch names in some cases. For example in x86 + # profiles the triple uses i686, but llvm will prefer i386 if invoked + # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will + # be used if invoked through ${CHOST}-clang{,++,-cpp} though. + # + # To make sure the correct triples are installed, + # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp + # and compare with CHOST values in profiles. + + local abi=${triple%%-*} + case ${abi} in + armv4l|armv4t|armv5tel|armv6j|armv7a) + _doclang_cfg ${triple/${abi}/arm} + ;; + i686) + _doclang_cfg ${triple/${abi}/i386} + ;; + sparc) + _doclang_cfg ${triple/${abi}/sparcel} + ;; + sparc64) + _doclang_cfg ${triple/${abi}/sparcv9} + ;; + esac +} + +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. + -Xarch_host -fstack-clash-protection + -Xarch_host -fstack-protector-strong + -fPIE + -include "${EPREFIX}/usr/include/gentoo/fortify.h" + EOF + + if use amd64; then + cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die + -Xarch_host -fcf-protection=$(usex cet full none) + EOF + fi + + if use kernel_Darwin; then + newins - gentoo-hardened-ld.cfg <<-EOF + # There was -Wl,-z,relro here, but it's not supported on Mac + # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job + EOF + else + 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 + -Wl,-z,now + EOF + fi + + 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 () && !defined(__GLIBC__) + # include + #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 + + # TODO: Maybe -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST for + # non-hardened? + 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE + EOF + + cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die + # Options below are conditional on USE=hardened. + 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}") + doclang_cfg "${abi_chost}" + done + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + # Gentoo Prefix on Darwin + -Wl,-search_paths_first + -Wl,-rpath,${EPREFIX}/usr/lib + -L ${EPREFIX}/usr/lib + -isystem ${EPREFIX}/usr/include + -isysroot ${EPREFIX}/MacOSX.sdk + EOF + if use bootstrap-prefix ; then + # bootstrap-prefix is only set during stage2 of bootstrapping + # Prefix, where EPREFIX is set to EPREFIX/tmp. + # Here we need to point it at the future lib dir of the stage3's + # EPREFIX. + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + -Wl,-rpath,${EPREFIX}/../usr/lib + EOF + fi + fi +} + +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 +} diff --git a/sys-devel/clang-common/clang-common-18.1.2.ebuild b/sys-devel/clang-common/clang-common-18.1.2.ebuild deleted file mode 100644 index 623368383908..000000000000 --- a/sys-devel/clang-common/clang-common-18.1.2.ebuild +++ /dev/null @@ -1,291 +0,0 @@ -# Copyright 1999-2024 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 ~arm64-macos ~ppc-macos ~x64-macos" -IUSE=" - default-compiler-rt default-libcxx default-lld - bootstrap-prefix hardened llvm-libunwind -" - -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 - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die - -lc++abi - EOF - fi - - 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 -} - -doclang_cfg() { - local triple="${1}" - - _doclang_cfg ${triple} - - # LLVM may have different arch names in some cases. For example in x86 - # profiles the triple uses i686, but llvm will prefer i386 if invoked - # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will - # be used if invoked through ${CHOST}-clang{,++,-cpp} though. - # - # To make sure the correct triples are installed, - # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp - # and compare with CHOST values in profiles. - - local abi=${triple%%-*} - case ${abi} in - armv4l|armv4t|armv5tel|armv6j|armv7a) - _doclang_cfg ${triple/${abi}/arm} - ;; - i686) - _doclang_cfg ${triple/${abi}/i386} - ;; - sparc) - _doclang_cfg ${triple/${abi}/sparcel} - ;; - sparc64) - _doclang_cfg ${triple/${abi}/sparcv9} - ;; - esac -} - -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 - - if use kernel_Darwin; then - newins - gentoo-hardened-ld.cfg <<-EOF - # There was -Wl,-z,relro here, but it's not supported on Mac - # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job - EOF - else - 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 - fi - - 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 () && !defined(__GLIBC__) - # include - #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 - - # TODO: Maybe -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST for - # non-hardened? - 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_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE - EOF - - cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die - # Options below are conditional on USE=hardened. - -Wl,-z,now - 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}") - doclang_cfg "${abi_chost}" - done - - if use kernel_Darwin; then - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - # Gentoo Prefix on Darwin - -Wl,-search_paths_first - -Wl,-rpath,${EPREFIX}/usr/lib - -L ${EPREFIX}/usr/lib - -isystem ${EPREFIX}/usr/include - -isysroot ${EPREFIX}/MacOSX.sdk - EOF - if use bootstrap-prefix ; then - # bootstrap-prefix is only set during stage2 of bootstrapping - # Prefix, where EPREFIX is set to EPREFIX/tmp. - # Here we need to point it at the future lib dir of the stage3's - # EPREFIX. - cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die - -Wl,-rpath,${EPREFIX}/../usr/lib - EOF - fi - fi -} - -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 -} diff --git a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild index 4cc526c1c3d1..45196776694b 100644 --- a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild +++ b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild @@ -25,7 +25,7 @@ PDEPEND=" !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/lld-${PV} ) !default-lld? ( sys-devel/binutils ) " IDEPEND=" diff --git a/sys-devel/clang-common/clang-common-19.0.0_pre20240322-r1.ebuild b/sys-devel/clang-common/clang-common-19.0.0_pre20240322-r1.ebuild index 4cc526c1c3d1..45196776694b 100644 --- a/sys-devel/clang-common/clang-common-19.0.0_pre20240322-r1.ebuild +++ b/sys-devel/clang-common/clang-common-19.0.0_pre20240322-r1.ebuild @@ -25,7 +25,7 @@ PDEPEND=" !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/lld-${PV} ) !default-lld? ( sys-devel/binutils ) " IDEPEND=" -- cgit v1.2.3