File Bear.spec of Package Bear

# spec file for package Bear
# Copyright (c) 2023 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%bcond_with     tests
Name:           Bear
Version:        3.1.3
Release:        0
Summary:        Tool to generate compilation database for clang tooling
License:        GPL-3.0-or-later
Source:         %{URL}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  bash-completion
BuildRequires:  cmake
BuildRequires:  pkgconfig
BuildRequires:  cmake(nlohmann_json) >= 3.7.3
BuildRequires:  pkgconfig(absl_synchronization)
BuildRequires:  pkgconfig(fmt) >= 6.1
BuildRequires:  pkgconfig(grpc)
BuildRequires:  pkgconfig(grpc++) >= 1.26
BuildRequires:  pkgconfig(protobuf) >= 3.11
BuildRequires:  pkgconfig(spdlog)
%if 0%{?suse_version} == 1500 && 0%{?sle_version} > 150200
BuildRequires:  gcc13-c++
BuildRequires:  gcc-c++
%if %{with tests}
BuildRequires:  fakeroot
# the fakeroot test requires xargs
BuildRequires:  findutils
# additional binaries for specific tests
%if 0%{?suse_version} == 1500 && 0%{?sle_version} > 150200
BuildRequires:  gcc13-fortran
BuildRequires:  gcc-fortran
BuildRequires:  python3-lit
BuildRequires:  python3-setuptools
# one of the tests requires /usr/bin/more
BuildRequires:  util-linux
BuildRequires:  valgrind
BuildRequires:  pkgconfig(gmock) >= 1.10
BuildRequires:  pkgconfig(gtest) >= 1.10
BuildRequires:  pkgconfig(gtest_main) >= 1.10

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.

%autosetup -p1

for f in $(ls test/bin/); do
    sed -i "s|^#\!%{_bindir}/env\s\+python\s\?$|#!python3|" test/bin/$f
%if 0%{?suse_version} == 1500 && 0%{?sle_version} > 150200
export CC=gcc-13
export CXX=g++-13
%cmake \
%if %{without tests}

# Let RPM install it correctly
rm -rf %{buildroot}%{_datadir}/doc

%license COPYING

openSUSE Build Service is sponsored by