diff options
Diffstat (limited to 'dev-util/bear')
-rw-r--r-- | dev-util/bear/Manifest | 2 | ||||
-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 |
3 files changed, 163 insertions, 0 deletions
diff --git a/dev-util/bear/Manifest b/dev-util/bear/Manifest index 9444aa62d5cf..dc8cd3964ff9 100644 --- a/dev-util/bear/Manifest +++ b/dev-util/bear/Manifest @@ -1,5 +1,7 @@ +AUX bear-3.1.4-tests.patch 2199 BLAKE2B 2f2c97705aec1d55e6166cb13858d3e6eda3cc44e9de0fdff9a9c452a71790542534bcb0740f28e47e061405eaf9e180cca49c12232fef8b63107a3e0fde1166 SHA512 89451e19647064fcbe7c31c328d0eddf33882a4a5b94903bc6e89b24bbfe30f2152afc813c40c0ae5aeb0909e0c9f7e190e21b7d9505b05c9f52741a35525f51 DIST bear-3.1.3.tar.gz 127766 BLAKE2B 8fdb5b9bf8e1e026df2296b0d45f23ce1a9157dda28b2656d36c0799e2f02965711ecdf09780d075e18965afc6a771dbf26501e9e1e3b26f4784d4191e168748 SHA512 34039b51a7cd636bdb7fb716f69d6c70de3e7bfc5e2c83a3040942010fb7effe49b0afa0d29be182eb550d57b024fbe5bea779a7fda5f86201865bf491ba1672 DIST bear-3.1.4.tar.gz 127672 BLAKE2B 18deb1172fcd8afdf4721a04b5d72b182190afd92d645841023033d187c812a0a30805af2bfb67b794ab8a8f0ca42965bebab6d035e95e2a25c5fccfe48a1afd SHA512 c63da7586d25a64dd8b3ff82f37505b36071dd064deb973c012840bc52ff6aec861fca21422b86b11629e86dc43d156b233d21b01e689369f0726799083afa98 EBUILD bear-3.1.3.ebuild 2294 BLAKE2B 567743514d620a381e558bc5f4f6af3d95bdcb16d5aa055002c9777fb349538a68a81bac5bbc95972f70b992aa3367df4ccd52ca6fbb849b4937f271a6b7fed2 SHA512 bfec90ac915f5af0a1d43239ea1234e407991a1841490630f988e12279147afe78316ca212ddf9eec864bd99ecda431169a0d52e24a70791ceb6a4b7fc3a011e +EBUILD bear-3.1.4-r1.ebuild 2671 BLAKE2B fe26bda46cd964c8e112426fb40b3109349e7001784d440b269843d5a45bbedd02aca00797d4f2f5154e3d038a19c63e30d213c6dd57aaf254296891791770a5 SHA512 db6d7b29fb7fab792544ef5c82fab43c537e26355026c625bfdad78f9654b68d3e0315d6a3a7f85490a91637c16fbb68fe250a9a54d72ecac3816d7053050557 EBUILD bear-3.1.4.ebuild 2294 BLAKE2B 931a5a1da0c5dabab6507e3f2ad2cb43d1f711358dbbd6772ac3b4d907715ebed380a8da34be723ace83d2e955792d03204ae0af05cf5dbe7d790f335c8473e4 SHA512 0da412c2b77dc6a3f6102046ca27e1a4151b85c8438c401d2f2ecae6427ddf34229298befb8459bb2056d7d8571287b1e8cc7f68c7119cc01ef65e080aa1d69a MISC metadata.xml 1067 BLAKE2B 180de420c2173d245fa29b092d80e2c94ae2df8ba5c1c9d3fa2d706c75fbbc489d08b61505bf612fe247b7a9384b220682549f47db77b8bc3e7b170be9663380 SHA512 df9e220346c2098767bafc1e212a94fedae90892de64d8f04c599f3caf124d3ab539a9d9f757b5ba5ed4ff895fa39b954409d551514c9ee6fe44296c2317a021 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}}; |