From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1651294-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id BF3F21581C1
	for <garchives@archives.gentoo.org>; Tue,  9 Jul 2024 12:52:39 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0EF55E2A40;
	Tue,  9 Jul 2024 12:52:39 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DFC68E2A40
	for <gentoo-commits@lists.gentoo.org>; Tue,  9 Jul 2024 12:52:38 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 004D0343008
	for <gentoo-commits@lists.gentoo.org>; Tue,  9 Jul 2024 12:52:38 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D52281E02
	for <gentoo-commits@lists.gentoo.org>; Tue,  9 Jul 2024 12:52:34 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1720529486.e204cb10f52f821ddaf924f90af17cacf735669b.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bear/files/, dev-util/bear/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-util/bear/bear-3.1.4-r1.ebuild dev-util/bear/files/bear-3.1.4-tests.patch
X-VCS-Directories: dev-util/bear/ dev-util/bear/files/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: e204cb10f52f821ddaf924f90af17cacf735669b
X-VCS-Branch: master
Date: Tue,  9 Jul 2024 12:52:34 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 1b91a4df-d7a3-4e1e-b7f3-d9fae236958d
X-Archives-Hash: ed8ffb7f02333768594ccb4045e7cedb

commit:     e204cb10f52f821ddaf924f90af17cacf735669b
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Jul  8 10:56:46 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul  9 12:51:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e204cb10

dev-util/bear: add 3.1.4-r1

- fixes cuda build
- Do not skip test based on FEATURES, per PMS Appendix B

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/bear/bear-3.1.4-r1.ebuild         | 112 +++++++++++++++++++++++++++++
 dev-util/bear/files/bear-3.1.4-tests.patch |  49 +++++++++++++
 2 files changed, 161 insertions(+)

diff --git a/dev-util/bear/bear-3.1.4-r1.ebuild b/dev-util/bear/bear-3.1.4-r1.ebuild
new file mode 100644
index 000000000000..d573a78f9b17
--- /dev/null
+++ b/dev-util/bear/bear-3.1.4-r1.ebuild
@@ -0,0 +1,112 @@
+# Copyright 2020-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit cuda cmake multiprocessing python-any-r1
+
+DESCRIPTION="Build EAR generates a compilation database for clang tooling"
+HOMEPAGE="https://github.com/rizsotto/Bear"
+SRC_URI="https://github.com/rizsotto/Bear/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${P^}"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="cuda test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	>=dev-libs/libfmt-9.1.0:=
+	dev-libs/protobuf:=
+	>=dev-libs/spdlog-1.11.0:=
+	>=net-libs/grpc-1.49.2:=
+	cuda? ( dev-util/nvidia-cuda-toolkit )
+"
+
+DEPEND="
+	${RDEPEND}
+	>=dev-cpp/nlohmann_json-3.11.2:=
+	test? (
+		>=dev-cpp/gtest-1.13
+	)
+"
+
+BDEPEND="
+	virtual/pkgconfig
+	test? (
+		dev-build/libtool
+		$(python_gen_any_dep '
+			dev-python/lit[${PYTHON_USEDEP}]
+		')
+	)
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.1.4-tests.patch"
+)
+
+pkg_setup() {
+	use test && python-any-r1_pkg_setup
+}
+
+src_prepare() {
+	cmake_src_prepare
+	# Turn off testing before installation
+	sed -i 's/TEST_BEFORE_INSTALL/TEST_EXCLUDE_FROM_MAIN/g' CMakeLists.txt || die
+}
+
+src_configure() {
+	# TODO: remove this when https://bugs.gentoo.org/928346 is fixed
+	export CMAKE_BUILD_PARALLEL_LEVEL=$(makeopts_jobs)
+
+	local mycmakeargs=(
+		-DENABLE_UNIT_TESTS="$(usex test)"
+		-DENABLE_FUNC_TESTS="$(usex test)"
+	)
+	cmake_src_configure
+}
+
+src_test() {
+	if has sandbox "${FEATURES}"; then
+		ewarn "FEATURES=sandbox detected"
+		ewarn "Bear overrides LD_PRELOAD and conflicts with gentoo sandbox"
+		ewarn "tests will fail"
+	fi
+	if has usersandbox "${FEATURES}"; then
+		ewarn "FEATURES=usersandbox detected"
+		ewarn "tests will fail"
+	fi
+	if
+		has network-sandbox "${FEATURES}"; then
+		ewarn "FEATURES=network-sandbox detected"
+		ewarn "tests will fail"
+	fi
+	if
+		has_version -b 'sys-devel/gcc-config[-native-symlinks]'; then
+		ewarn "\'sys-devel/gcc-config[-native-symlinks]\' detected, tests call /usr/bin/cc directly (hardcoded)"
+		ewarn "and will fail without generic cc symlink"
+	fi
+
+	einfo "test may use optional tools if found: gfortran libtool nvcc valgrind"
+
+	# unit tests
+	BUILD_DIR="${BUILD_DIR}/subprojects/Build/BearSource" cmake_src_test
+
+	# functional tests
+	if use cuda; then
+		NVCC_CCBIN="$(cuda_gccdir)"
+		export NVCC_CCBIN
+	else
+		LIT_SKIP_TESTS+=( "cases/compilation/output/compile_cuda.sh" )
+	fi
+
+	mylitopts+=(-j "$(makeopts_jobs)" )
+	[[ -n "${LIT_SKIP_TESTS[*]}" ]] && mylitopts+=( --filter-out "($( IFS='|'; echo "${CMAKE_SKIP_TESTS[*]}"))" )
+
+	export LIT_OPTS="${mylitopts[*]}"
+
+	BUILD_DIR="${BUILD_DIR}/subprojects/Build/BearTest" cmake_src_test
+}

diff --git a/dev-util/bear/files/bear-3.1.4-tests.patch b/dev-util/bear/files/bear-3.1.4-tests.patch
new file mode 100644
index 000000000000..d6df55908cbc
--- /dev/null
+++ b/dev-util/bear/files/bear-3.1.4-tests.patch
@@ -0,0 +1,49 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Subject: [PATCH] Fix tests
+# https://github.com/rizsotto/Bear/issues/445
+diff --git a/test/lit.cfg b/test/lit.cfg
+index 2a3868a..cf0c9de 100644
+--- a/test/lit.cfg
++++ b/test/lit.cfg
+@@ -31,6 +31,7 @@ config.excludes = []
+ 
+ config.environment['LC_CTYPE'] = 'en_US.UTF-8'
+ config.environment['PATH'] = ":".join([os.path.join(this_dir, 'bin'), os.environ.get('PATH')])
++config.environment['PYTHONDONTWRITEBYTECODE'] = '1'
+ 
+ # add bear install directory in case if it's not in the path
+ if '_BEAR_BIN_DIR' in lit_config.params:
+@@ -161,6 +162,12 @@ if which('nvcc'):
+     path = which('nvcc')
+     config.substitutions.append(('%{cuda}', path))
+     config.available_features.add('cuda')
++    if 'NVCC_PREPEND_FLAGS' in os.environ:
++        config.environment['NVCC_PREPEND_FLAGS'] = os.environ.get('NVCC_PREPEND_FLAGS')
++    if 'NVCC_APPEND_FLAGS' in os.environ:
++        config.environment['NVCC_APPEND_FLAGS'] = os.environ.get('NVCC_APPEND_FLAGS')
++    if 'NVCC_CCBIN' in os.environ:
++        config.environment['NVCC_CCBIN'] = os.environ.get('NVCC_CCBIN')
+ 
+ 
+ # check if libtool command is available
+@@ -183,7 +183,7 @@ if which('fakeroot'):
+ 
+ 
+ # check if valgrind is available
+-if which('valgrind'):
++if which('valgrind') and False:
+     path = which('valgrind')
+     config.substitutions.append(('%{valgrind}', path))
+     config.available_features.add('valgrind')
+diff --git a/test/cases/compilation/output/compile_cuda.sh b/test/cases/compilation/output/compile_cuda.sh
+index 41b8b37..9ef4954 100644
+--- a/test/cases/compilation/output/compile_cuda.sh
++++ b/test/cases/compilation/output/compile_cuda.sh
+@@ -8,5 +8,5 @@
+ 
+ touch successful_build_1.cu successful_build_2.cu
+ 
+-$CC -c -o successful_build_1.o successful_build_1.cu;
+-$CC -c -o successful_build_2.o successful_build_2.cu;
++$CC${NVCC_CCBIN:+ -ccbin ${NVCC_CCBIN}}${NVCC_PREPEND_FLAGS:+ ${NVCC_PREPEND_FLAGS}} -c -o successful_build_1.o successful_build_1.cu${NVCC_APPEND_FLAGS:+ ${NVCC_APPEND_FLAGS}};
++$CC${NVCC_CCBIN:+ -ccbin ${NVCC_CCBIN}}${NVCC_PREPEND_FLAGS:+ ${NVCC_PREPEND_FLAGS}} -c -o successful_build_2.o successful_build_2.cu${NVCC_APPEND_FLAGS:+ ${NVCC_APPEND_FLAGS}};