From d2057a668e1fab34f6e95d1ec41878698fc71377 Mon Sep 17 00:00:00 2001
From: Michał Górny <mgorny@gentoo.org>
Date: Wed, 19 Apr 2023 17:45:27 +0200
Subject: sys-libs/compiler-rt: Bump to 16.0.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 sys-libs/compiler-rt/Manifest                  |   2 +
 sys-libs/compiler-rt/compiler-rt-16.0.2.ebuild | 149 +++++++++++++++++++++++++
 2 files changed, 151 insertions(+)
 create mode 100644 sys-libs/compiler-rt/compiler-rt-16.0.2.ebuild

(limited to 'sys-libs')

diff --git a/sys-libs/compiler-rt/Manifest b/sys-libs/compiler-rt/Manifest
index fe5b065862da..feb0dcafc244 100644
--- a/sys-libs/compiler-rt/Manifest
+++ b/sys-libs/compiler-rt/Manifest
@@ -7,4 +7,6 @@ DIST llvm-project-15.0.7.src.tar.xz 110936452 BLAKE2B f3d277e2029157329e5be78b78
 DIST llvm-project-15.0.7.src.tar.xz.sig 566 BLAKE2B 47dc8c82d86237b80c6d85f83a6c9a6e9e174cf8e7f367b071e0cd9481d7cd408e991337c5624e07f3f370f26387c814f212808575ed1c1b58404d3e3836b7df SHA512 fc6891b440dd1175eb8df3790590af8d36bc92301660f84744ae15123475aeb900a151e6a8e7998ded27ec4d86871903ad0b89cd61164943054c2e3bc8d8beb2
 DIST llvm-project-16.0.1.src.tar.xz 117990772 BLAKE2B 298189ce6d7245711e5bd3e03fa74d603dda5a458463ca0cb261fe6949290c46a70abbd1ad1c556e08da3adc5df577305e267c1135214b900d78502e39b46bc5 SHA512 98fc11c0ad90d5e5a2cb123b497b89a1583fe7f91b3ff05c335037801ef66cbfab08f6d2eff539f0da238e9685d4bc7a9fb2578e28864fc9e9357b84129cefaa
 DIST llvm-project-16.0.1.src.tar.xz.sig 566 BLAKE2B 06c03d789e63ab30bba4c56ba9ec91400d804448482d6a7fd395252b3b9166a5ee7a42a94c2074aa0d1809a3327f993d8932211f3fc05ad281db64c17b2a7094 SHA512 f42db28eb8280db06b1c78fa7a7aaea3a79499cecee1a64ce18c49b90c755b3a78fc93f01d1855887c7918ccc927c3b6147cfc916520f05d4cef65381ca6fe60
+DIST llvm-project-16.0.2.src.tar.xz 117995768 BLAKE2B b329b2b123428f3a966a96f074a75520f07d12fc13ec755403cff2346b23195e6a0c05ca9e789b4cf5b4b3557a922bd41d8dffb6056ee33fbbf2b81001511fae SHA512 4ca76aaaca8812a06a94071e7444a3213d85dca51ea86f6125f854776f69a3e088a92d0621e3911e526f280b35bfb778fb3742c6010d3ed1eba605c08720377c
+DIST llvm-project-16.0.2.src.tar.xz.sig 566 BLAKE2B 8243748ac27e4eec3cc011371e179e19f1005336f07d956fd358f649d1429c8d0ea22ecc376b1dec9fe3db971467ad1dd63e97bb089885d0e1994eeab26b6fd7 SHA512 dbe9367a259954a38f2369b2f226726162090227f1a5ae8c8809eaae47cad7b3b26c754633e6e5c54cacd6360a504d7ba4c659d9232c1648388d657a2aaad10c
 DIST llvm-project-5c60a08c696c0420ddc5fdad5b8e50a7528cb3bf.tar.gz 182291041 BLAKE2B f5997611e0293df515d4494d14895cc8fbe22b536f5c419e4ad7d098acbf2b1046ceb332d865eacdae0b7fa1a77b78090551976835dd1b95b5270c9f6e12e410 SHA512 6cda8e55b4fc70e94838c772c56213c811affda96fb98a03d432348f995a313447d0e0e84533350e1fda3162d82633b260ccd8e3b1d59d3216187b44dc5556fb
diff --git a/sys-libs/compiler-rt/compiler-rt-16.0.2.ebuild b/sys-libs/compiler-rt/compiler-rt-16.0.2.ebuild
new file mode 100644
index 000000000000..49b92c7f0e51
--- /dev/null
+++ b/sys-libs/compiler-rt/compiler-rt-16.0.2.ebuild
@@ -0,0 +1,149 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+inherit cmake flag-o-matic llvm llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="Compiler runtime library for clang (built-in part)"
+HOMEPAGE="https://llvm.org/"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="${LLVM_MAJOR}"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~ppc-macos ~x64-macos"
+IUSE="+abi_x86_32 abi_x86_64 +clang debug test"
+RESTRICT="!test? ( test ) !clang? ( test )"
+
+DEPEND="
+	sys-devel/llvm:${LLVM_MAJOR}
+"
+BDEPEND="
+	>=dev-util/cmake-3.16
+	clang? ( sys-devel/clang )
+	test? (
+		$(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
+		=sys-devel/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
+	)
+	!test? (
+		${PYTHON_DEPS}
+	)
+"
+
+LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake )
+llvm.org_set_globals
+
+python_check_deps() {
+	use test || return 0
+	python_has_version ">=dev-python/lit-15[${PYTHON_USEDEP}]"
+}
+
+pkg_pretend() {
+	if ! use clang && ! tc-is-clang; then
+		ewarn "Building using a compiler other than clang may result in broken atomics"
+		ewarn "library. Enable USE=clang unless you have a very good reason not to."
+	fi
+}
+
+pkg_setup() {
+	# Darwin Prefix builds do not have llvm installed yet, so rely on
+	# bootstrap-prefix to set the appropriate path vars to LLVM instead
+	# of using llvm_pkg_setup.
+	if [[ ${CHOST} != *-darwin* ]] || has_version sys-devel/llvm; then
+		LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
+	fi
+	python-any-r1_pkg_setup
+}
+
+test_compiler() {
+	$(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
+		<<<'int main() { return 0; }' &>/dev/null
+}
+
+src_configure() {
+	# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+	use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+	# pre-set since we need to pass it to cmake
+	BUILD_DIR=${WORKDIR}/${P}_build
+
+	if use clang; then
+		# Only do this conditionally to allow overriding with
+		# e.g. CC=clang-13 in case of breakage
+		if ! tc-is-clang ; then
+			local -x CC=${CHOST}-clang
+			local -x CXX=${CHOST}-clang++
+		fi
+
+		strip-unsupported-flags
+	fi
+
+	if ! test_compiler; then
+		local nolib_flags=( -nodefaultlibs -lc )
+
+		if test_compiler "${nolib_flags[@]}"; then
+			local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+			ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
+		elif test_compiler "${nolib_flags[@]}" -nostartfiles; then
+			# Avoiding -nostartfiles earlier on for bug #862540,
+			# and set available entry symbol for bug #862798.
+			nolib_flags+=( -nostartfiles -emain )
+
+			local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+			ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
+		fi
+	fi
+
+	local mycmakeargs=(
+		-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}"
+
+		-DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
+		-DCOMPILER_RT_BUILD_LIBFUZZER=OFF
+		-DCOMPILER_RT_BUILD_MEMPROF=OFF
+		-DCOMPILER_RT_BUILD_ORC=OFF
+		-DCOMPILER_RT_BUILD_PROFILE=OFF
+		-DCOMPILER_RT_BUILD_SANITIZERS=OFF
+		-DCOMPILER_RT_BUILD_XRAY=OFF
+
+		-DPython3_EXECUTABLE="${PYTHON}"
+	)
+
+	if use amd64; then
+		mycmakeargs+=(
+			-DCAN_TARGET_i386=$(usex abi_x86_32)
+			-DCAN_TARGET_x86_64=$(usex abi_x86_64)
+		)
+	fi
+
+	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
+		mycmakeargs+=(
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX.
+			# This disables i386 for SDK >= 10.15
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
+		)
+	fi
+
+	if use test; then
+		mycmakeargs+=(
+			-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+			-DLLVM_LIT_ARGS="$(get_lit_flags)"
+
+			-DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang"
+			-DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang++"
+		)
+	fi
+
+	cmake_src_configure
+}
+
+src_test() {
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+
+	cmake_build check-builtins
+}
-- 
cgit v1.2.3-65-gdbad