File clang-include-graph.spec of Package clang-include-graph

#
# spec file for package clang-include-graph
#
# Copyright (c) 2025 Boian Berberov
#
# 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 https://bugs.opensuse.org/
#

# %%global         gitdate  20250505
# %%global         gitrev   e0c4900
# %%global         gitcomm  e0c4900026812c8b42c69f8694fb092daf1b522d
# %%global         gitrel   git%%{gitdate}.%%{gitrev}



Name:           clang-include-graph
Version:        0.2.0
Release:        0%{?dist}
Summary:        Tool for analyzing C++ project include graph
License:        Apache-2.0
URL:            https://github.com/bkryza/%{name}

%if %{defined gitcomm}
Source0:        %{url}/archive/%{gitcomm}.tar.gz
%else
Source0:        %{url}/archive/refs/tags/%{version}.tar.gz
%endif

BuildRequires:  clang
BuildRequires:  cmake >= 3.10

BuildRequires:  clang-devel

# `clang-tidy` is part of `clang` in openSUSE
%if ! 0%{?is_opensuse}
BuildRequires:  clang-tools-extra
%endif

# NOTE Boost 1.75.0 fails on MPL
%if 0%{?is_opensuse}
BuildRequires:  libboost_atomic-devel           >= 1.81.0
BuildRequires:  libboost_filesystem-devel       >= 1.81.0
BuildRequires:  libboost_graph-devel            >= 1.81.0
BuildRequires:  libboost_log-devel              >= 1.81.0
BuildRequires:  libboost_program_options-devel  >= 1.81.0
BuildRequires:  libboost_regex-devel            >= 1.81.0
BuildRequires:  libboost_test-devel             >= 1.81.0
BuildRequires:  libboost_thread-devel           >= 1.81.0

# BUG: There is no `-devel` ?!
BuildRequires:  libboost_json-devel-impl        >= 1.81.0
%else
BuildRequires:  boost-devel                     >= 1.81.0
%endif

BuildRequires:  llvm-devel

Requires:       clang

%description
Tool for analyzing C++ project include graph



%prep
%if %{defined gitcomm}
%setup -q -n %{name}-%{gitcomm}
%else
%setup -q
%endif



%build
%cmake \
	-DCMAKE_C_COMPILER=clang \
	-DCMAKE_CXX_COMPILER=clang++ \
%if 0%{?fedora} || 0%{?mageia}
	-DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name} \
%endif
	-DGIT_VERSION=%{version}

%cmake_build



%install
%cmake_install

# Don't install LICENSE.md twice
%__rm %{buildroot}%{_defaultdocdir}/%{name}/LICENSE.md



%files
%license LICENSE.md
%{_bindir}/%{name}
%{_docdir}/%{name}/



%changelog

* Tue Jul 15 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by