#
# spec file for package Bear
#
# Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, but changing it is not allowed.
#
# This file is under the GNU GENERAL PUBLIC LICENSE Version 3.
#
%bcond_with tests
Name: Bear
Version: 3.0.20
Release: 8
Summary: Tool to generate compilation database for clang tooling
License: GPL-3.0-or-later
URL: https://github.com/rizsotto/Bear
Source0: %{name}-%{version}.tar.gz
Source1: googletest-release-1.12.1.tar.gz
Source2: fmt-9.0.0.tar.gz
Source3: json-3.11.3.tar.gz
Source4: spdlog-1.10.0.tar.gz
BuildRequires: bash-completion
BuildRequires: gcc, gcc-c++, make
BuildRequires: protobuf-devel, grpc-devel, grpc-plugins
BuildRequires: c-ares-devel
BuildRequires: glibc-devel, glibc-debuginfo
BuildRequires: cmake
BuildRequires: pkgconfig(absl_synchronization)
BuildRequires: pkgconfig(grpc)
BuildRequires: pkgconfig(grpc++) >= 1.26
BuildRequires: pkgconfig(protobuf) >= 3.11
%if %{with tests}
BuildRequires: python
BuildRequires: python3-lit
BuildRequires: python3-setuptools
# one of the tests requires /usr/bin/more
BuildRequires: util-linux
# additional binaries for specific tests
BuildRequires: gcc-fortran
BuildRequires: fakeroot
BuildRequires: valgrind
# the fakeroot test requires xargs
BuildRequires: findutils
%endif
Patch1: 0001-change-external-project-to-local-package.patch
Patch2: 0002-Rebuild-when-add-option-failed.patch
Patch3: 0003-Bugfix-skip-rebuild-without-new-options-and-preprocess.patch
Patch4: 0004-skip-bearsource-test-when-disabled.patch
%description
Bear is a tool to generate compilation database for clang tooling.
One way to get compilation database is to use cmake as build tool. When the
project compiles with no cmake, but another build system, there is no free json
file. Bear is a tool to generate such file during the build process.
%prep
%autosetup -p1 -n %{name}-%{version}
%build
export CMAKE_BUILD_PARALLEL_LEVEL=4
%cmake \
-DDEPEND_PATH=%{_sourcedir} \
%if %{with tests}
-DENABLE_UNIT_TESTS=ON \
-DENABLE_FUNC_TESTS=ON
%else
-DENABLE_UNIT_TESTS=OFF \
-DENABLE_FUNC_TESTS=OFF
%endif
%cmake_build
%install
%cmake_install
# Let RPM install it correctly
rm -rf %{buildroot}%{_datadir}/doc
%files
%license COPYING
%doc README.md
%{_bindir}/bear
%{_bindir}/citnames
%{_bindir}/intercept
%{_mandir}/man1/bear.1*
%{_mandir}/man1/citnames.1*
%{_mandir}/man1/intercept.1*
%{_libdir}/bear/
%changelog
* Wed Jul 29 2026 AIchemist <anengi@163.com> - 3.0.20-8
- skip BearSource test step when unit tests are disabled
- limit nested CMake build parallelism to avoid out-of-memory failures
* Sun Mar 02 2025 Funda Wang <fundawang@yeah.net> - 3.0.20-6
- update json third_party dependencies for build with cmake 4.0
* Wed Nov 13 2024 Funda Wang <fundawang@yeah.net> - 3.0.20-5
- adopt to new cmake macro
* Fri Jan 6 2023 yangtao <yangt111@chinatelecom.cn> - 3.0.20-4
- Type:SPEC
- ID:NA
- SUG:NA
- DESC: fix missing other tar.gz packages in src.rpm.
* Mon Dec 19 2022 zhaowenyu <804544223@qq.com> - 3.0.20-3
- Type:SPEC
- ID:NA
- SUG:NA
- DESC:Skip rebuild without new options and preprocess
* Thu Dec 01 2022 zhaowenyu <804544223@qq.com> - 3.0.20-2
- Type:SPEC
- ID:NA
- SUG:NA
- DESC:Rebuild when add option failed
* Wed Nov 16 2022 zhaowenyu <804544223@qq.com> - 3.0.20-1
- Type:Init
- ID:NA
- SUG:NA
- DESC:Init Bear 3.0.20 repository