dev-util/bear: add 3.1.6

Signed-off-by: Alexey Sokolov <alexey+gentoo@asokolov.org>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Alexey Sokolov
2025-03-26 02:19:13 +00:00
committed by Sam James
parent dae021f706
commit 07a8e14cb8
3 changed files with 129 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST bear-3.1.5.tar.gz 152228 BLAKE2B 64d03d1ca5b1473e4d0b2106969285a2391471a0027cf387c72fe70769293fa361196cb1d37ebb528d27b5741b792472fad09688761ab7f73dc0ea7db96d8be1 SHA512 acf233f7bb8215694734b6c947c965323c0a5ea0c2a6bbb210a37e38fdf545326ca8de3a7b31ce81469756afd1c02233775ddc5936fd04132f216def6e3ce1de
DIST bear-3.1.6.tar.gz 170892 BLAKE2B dc54bf28ad329e39b609b4993a1b6a78b4ea6562fa57b1615f4b7885c0aab70a124c485c435f3cb341be2915ee7f0b80ab9362c3504899d436271208e25cf239 SHA512 5852ca8d93459a9e1a6d2e030cc3963c213bf1638241825ec5df4eea7e3460faca9436ca2e36b8e5da40222306a0ecc8ed80d1f5e518ddd97dc5e200d42a75bb

View File

@@ -0,0 +1,114 @@
# Copyright 2020-2025 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"
"${FILESDIR}/${PN}-3.1.4-reduce-grpc-verbosity.patch"
"${FILESDIR}/${PN}-3.1.6-always.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 "${LIT_SKIP_TESTS[*]}"))" )
export LIT_OPTS="${mylitopts[*]}"
BUILD_DIR="${BUILD_DIR}/subprojects/Build/BearTest" cmake_src_test
}

View File

@@ -0,0 +1,14 @@
Reverse of https://github.com/rizsotto/Bear/commit/83383261e0756d2a5c5b85cf469f1fa34110c9ed
https://github.com/rizsotto/Bear/issues/625
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,8 +83,6 @@ ExternalProject_Add(BearSource
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
-DROOT_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
${CMAKE_CACHE_ARGS_EXTRA}
- BUILD_ALWAYS
- 1
TEST_BEFORE_INSTALL
1
TEST_COMMAND