From a8df9d79f2a0a6e6912ba53313f5f441267d615f Mon Sep 17 00:00:00 2001
From: Michał Górny <mgorny@gentoo.org>
Date: Tue, 9 Aug 2022 15:32:06 +0200
Subject: sys-libs/libcxx: Bump to 15.0.0_rc2
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/libcxx/Manifest                 |   3 +
 sys-libs/libcxx/libcxx-15.0.0_rc2.ebuild | 228 +++++++++++++++++++++++++++++++
 2 files changed, 231 insertions(+)
 create mode 100644 sys-libs/libcxx/libcxx-15.0.0_rc2.ebuild

(limited to 'sys-libs/libcxx')

diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
index 3c063a38941d..6fd071d8cb28 100644
--- a/sys-libs/libcxx/Manifest
+++ b/sys-libs/libcxx/Manifest
@@ -1,6 +1,9 @@
 DIST llvm-gentoo-patchset-13.0.1.tar.xz 6288 BLAKE2B 899222b962486e924e4f8a2b574d285531a3f87af9385ff68c81db92aa224a0cde6d4ee049b5405056bedb4b232b50e1d5840024071a4a215f6311853304c92d SHA512 b2805337f1deca626768a44c5e7ac9ed16e0c31bead1647d44a493a8123c1b8e8f1c8ceee3536bcc6fa87fdd3fcec408229f701adf30eff07e7ef9889b847b01
 DIST llvm-gentoo-patchset-14.0.6-r2.tar.xz 16120 BLAKE2B e12e522fdb7ba505693c679cb09cc8e00e6a954df195c86c2af4dbf1b68334a405b8dcc45f2e28b5e5e0b7e9d5eb7ba907337027927371b7a3b7784ff8aae7e0 SHA512 8a5ea71c30fc0727cc855dd812bbcb6d5f51c80c98eb3d5b80258d5c5eaab1310edc9d53ae63c2ca827abec68e2912c4b69ef0da351ff883fb30545a61e1d09c
+DIST llvm-gentoo-patchset-15.0.0-rc2.tar.xz 5768 BLAKE2B 03822c4dfbe3157d9131a3524beeda22fbc6adc937af052fd0fbcc23fb6ea86e1a5e015c316b53019820de5b81b1b065bfcbc31608598307f03af39f215fb12e SHA512 b9d7adb9b738a565c2142360c5ff7a7aa8405ce78af8767867203dd003e5bdb2b8a7f14179fdb7dc0c5cdc696cfff55c4886cfcd0894672284b453943e4e7269
 DIST llvm-gentoo-patchset-9999-1.tar.xz 4032 BLAKE2B b9413484dafed8ae0c68c2c164b45fd07bb8d5d0898f03abe118fd2120ffcb1fb6c949de9649a97c2e8105f24b9d131a725c67c0a502ca4d4d192c1a0d65f49d SHA512 e64449eeaf756c5bd945109937b84ba4bd8a015222bd792d39cf3947871e87571a4ca57814790e51544cb05ad4c2d1f044e818e4caaac7c2e2a02cb1aa290fcc
 DIST llvm-project-14.0.6.src.tar.xz 105618228 BLAKE2B ee67c5407df8cef493b9c0004f15e428f22a536a17e5f4e3eb29a003b8a8ec0abe0fa3e072591161d5f30ef7d8867c1ce34d1b341ad858e93c00263499941a99 SHA512 6fc6eeb60fac698702d1aac495fc0161eb7216a1f8db2020af8fccec5837831f7cc20dc2a169bf4f0b5f520748280b4a86621f3697d622aa58faaa45dbfaad13
 DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B cb658ad43d8ab6c43a5773aedadf0569c97b5ee4b1bd58eceb10e1879a30880c741c3d66bedd462c892309b688fb7b2673115a62d1f74d71ee375a578de9547f SHA512 b4a7b368532a7a4a24376cfa7db8f6d3478f6d4446474342fc00b474ecf466330cd0f16783209263c4c72d5fc7ddedfb11b95578842e700cfb7ee0bb34cc95d6
+DIST llvm-project-15.0.0rc2.src.tar.xz 112110968 BLAKE2B 98c3769f17f1958fbec771409eef781f5ca845363656c70fe5cd20bca1b8471e7a8773a7d4e395700c297a5f3f208fe1303cf18e2a73b45388b782fb7484106b SHA512 eee1bee1f83cc468fb4bb6839acbd5c1618dc35f35e51cd078288b91bad95d52edaadd05c88f2d72d51c1c338ba08b3346c070a28693b1224639eb7a1ef4a4d9
+DIST llvm-project-15.0.0rc2.src.tar.xz.sig 438 BLAKE2B 09f260b30724b41b27ef621929c086fd6c13bde51c4adb880897b549b2d336682f617faf3dd636ceb795e329b664972cf50745ab49f84e7540658d53074510da SHA512 9f695a309fbb15026dc133eb17d33abd26831eb036fad79dd8df37d4f4d9eeae1ca463acd037d2a1882bc2cff763e4bda507d1d827d845613bfd62d0f9fbd4ca
 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f
diff --git a/sys-libs/libcxx/libcxx-15.0.0_rc2.ebuild b/sys-libs/libcxx/libcxx-15.0.0_rc2.ebuild
new file mode 100644
index 000000000000..e6120dc78ebd
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-15.0.0_rc2.ebuild
@@ -0,0 +1,228 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_ECLASS=cmake
+PYTHON_COMPAT=( python3_{8..11} )
+inherit cmake-multilib flag-o-matic llvm llvm.org python-any-r1 \
+	toolchain-funcs
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="https://libcxx.llvm.org/"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS=""
+IUSE="+clang +libcxxabi static-libs test"
+REQUIRED_USE="test? ( clang )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	libcxxabi? (
+		~sys-libs/libcxxabi-${PV}[static-libs?,${MULTILIB_USEDEP}]
+	)
+	!libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )
+"
+# llvm-6 for new lit options
+# clang-3.9.0 installs necessary target symlinks unconditionally
+# which removes the need for MULTILIB_USEDEP
+DEPEND="
+	${RDEPEND}
+	>=sys-devel/llvm-6
+"
+BDEPEND="
+	clang? (
+		sys-devel/clang
+	)
+	!test? (
+		${PYTHON_DEPS}
+	)
+	test? (
+		>=dev-util/cmake-3.16
+		sys-devel/gdb[python]
+		$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
+	)
+"
+
+LLVM_COMPONENTS=( runtimes libcxx{,abi} llvm/{cmake,utils/llvm-lit} cmake )
+LLVM_PATCHSET=${PV/_/-}
+llvm.org_set_globals
+
+python_check_deps() {
+	use test || return 0
+	has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+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 dev-lang/llvm; then
+		llvm_pkg_setup
+	fi
+	python-any-r1_pkg_setup
+
+	if ! use libcxxabi && ! tc-is-gcc ; then
+		eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
+		eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
+		eerror "and try again."
+		die
+	fi
+}
+
+test_compiler() {
+	$(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
+		<<<'int main() { return 0; }' &>/dev/null
+}
+
+src_configure() {
+	# note: we need to do this before multilib kicks in since it will
+	# alter the CHOST
+	local cxxabi cxxabi_incs
+	if use libcxxabi; then
+		cxxabi=system-libcxxabi
+		cxxabi_incs="${EPREFIX}/usr/include/c++/v1"
+	else
+		local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
+		cxxabi=libsupc++
+		cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
+	fi
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+	if use clang && ! tc-is-clang; then
+		# Only do this conditionally to allow overriding with
+		# e.g. CC=clang-13 in case of breakage
+		local -x CC=${CHOST}-clang
+		local -x CXX=${CHOST}-clang++
+		strip-unsupported-flags
+	fi
+
+	# link against compiler-rt instead of libgcc if this is what clang does
+	local want_compiler_rt=OFF
+	if tc-is-clang; then
+		local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+			${LDFLAGS} -print-libgcc-file-name)
+		if [[ ${compiler_rt} == *libclang_rt* ]]; then
+			want_compiler_rt=ON
+		fi
+	fi
+
+	# bootstrap: cmake is unhappy if compiler can't link to stdlib
+	local nolib_flags=( -nodefaultlibs -lc )
+	if ! test_compiler; then
+		if test_compiler "${nolib_flags[@]}"; then
+			local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+			ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
+		fi
+	fi
+
+	local libdir=$(get_libdir)
+	local mycmakeargs=(
+		-DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
+		-DPython3_EXECUTABLE="${PYTHON}"
+		-DLLVM_ENABLE_RUNTIMES=libcxx
+		-DLLVM_INCLUDE_TESTS=OFF
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+		-DLIBCXX_ENABLE_SHARED=ON
+		-DLIBCXX_ENABLE_STATIC=$(usex static-libs)
+		-DLIBCXX_CXX_ABI=${cxxabi}
+		-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
+		# we're using our own mechanism for generating linker scripts
+		-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
+		-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+		-DLIBCXX_INCLUDE_BENCHMARKS=OFF
+		-DLIBCXX_INCLUDE_TESTS=$(usex test)
+		-DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
+	)
+
+	if use test; then
+		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
+		[[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
+
+		mycmakeargs+=(
+			-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+			-DLLVM_LIT_ARGS="$(get_lit_flags)"
+			-DPython3_EXECUTABLE="${PYTHON}"
+		)
+	fi
+	cmake_src_configure
+}
+
+multilib_src_compile() {
+	cmake_src_compile
+	if [[ ${CHOST} != *-darwin* ]] ; then
+		gen_shared_ldscript
+		use static-libs && gen_static_ldscript
+	fi
+}
+
+multilib_src_test() {
+	local -x LIT_PRESERVES_TMP=1
+	cmake_build check-cxx
+}
+
+multilib_src_install() {
+	cmake_src_install
+	# since we've replaced libc++.{a,so} with ldscripts, now we have to
+	# install the extra symlinks
+	if [[ ${CHOST} != *-darwin* ]] ; then
+		dolib.so lib/libc++_shared.so
+		use static-libs && dolib.a lib/libc++_static.a
+	fi
+}
+
+# Usage: deps
+gen_ldscript() {
+	local output_format
+	output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+	[[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+	cat <<-END_LDSCRIPT
+/* GNU ld script
+   Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+	# Move it first.
+	mv lib/libc++{,_static}.a || die
+	# Generate libc++.a ldscript for inclusion of its dependencies so that
+	# clang++ -stdlib=libc++ -static works out of the box.
+	local deps=(
+		libc++_static.a
+		$(usex libcxxabi libc++abi.a libsupc++.a)
+	)
+	# On Linux/glibc it does not link without libpthread or libdl. It is
+	# fine on FreeBSD.
+	use elibc_glibc && deps+=( libpthread.a libdl.a )
+
+	gen_ldscript "${deps[*]}" > lib/libc++.a || die
+}
+
+gen_shared_ldscript() {
+	# Move it first.
+	mv lib/libc++{,_shared}.so || die
+	local deps=(
+		libc++_shared.so
+		# libsupc++ doesn't have a shared version
+		$(usex libcxxabi libc++abi.so libsupc++.a)
+	)
+
+	gen_ldscript "${deps[*]}" > lib/libc++.so || die
+}
+
+pkg_postinst() {
+	elog "This package (${PN}) is mainly intended as a replacement for the C++"
+	elog "standard library when using clang."
+	elog "To use it, instead of libstdc++, use:"
+	elog "    clang++ -stdlib=libc++"
+	elog "to compile your C++ programs."
+}
-- 
cgit v1.2.3-65-gdbad