diff options
author | Paul Zander <negril.nx+gentoo@gmail.com> | 2024-07-08 12:56:46 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-07-09 13:51:26 +0100 |
commit | e204cb10f52f821ddaf924f90af17cacf735669b (patch) | |
tree | 04f6e984ca0b5fd8aa41e5a50529f6655d61f8ef /dev-util | |
parent | net-libs/grpc: add 1.65.0 (diff) | |
download | gentoo-e204cb10f52f821ddaf924f90af17cacf735669b.tar.gz gentoo-e204cb10f52f821ddaf924f90af17cacf735669b.tar.bz2 gentoo-e204cb10f52f821ddaf924f90af17cacf735669b.zip |
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@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util')
-rw-r--r-- | dev-util/bear/bear-3.1.4-r1.ebuild | 112 | ||||
-rw-r--r-- | dev-util/bear/files/bear-3.1.4-tests.patch | 49 |
2 files changed, 161 insertions, 0 deletions
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}}; |