File sourcetrail.spec of Package sourcetrail
#
# spec file for package sourcetrail
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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/
#
%bcond_with java
%bcond_without tests
%define min_boost_version 1.83
%define clang_version 20
%define java_version 21
%define _lto_cflags %{nil}
Name: sourcetrail
Version: 2025.9.9
Release: 0
Summary: Free and open-source cross-platform source explorer
License: GPL-3.0-only
URL: https://github.com/petermost/Sourcetrail
Source0: https://github.com/petermost/Sourcetrail/archive/refs/tags/%{version}.tar.gz
Source1: tinyxml.pc
Patch0: cmake.patch
BuildRequires: clang%{clang_version}-devel
BuildRequires: cmake
BuildRequires: libboost_date_time-devel >= %{min_boost_version}
BuildRequires: libboost_filesystem-devel >= %{min_boost_version}
BuildRequires: libboost_headers-devel >= %{min_boost_version}
BuildRequires: libboost_locale-devel >= %{min_boost_version}
BuildRequires: libboost_program_options-devel >= %{min_boost_version}
BuildRequires: ninja
BuildRequires: tinyxml-devel
BuildRequires: pkgconfig(Qt6Core)
BuildRequires: pkgconfig(Qt6Network)
BuildRequires: pkgconfig(Qt6PrintSupport)
BuildRequires: pkgconfig(Qt6Svg)
BuildRequires: pkgconfig(libedit)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(sqlite3)
%if %{with java}
BuildRequires: java-%{java_version}-openjdk-devel
BuildRequires: maven
%endif
%if %{with tests}
BuildRequires: gmock
BuildRequires: pkgconfig(catch2)
%endif
%description
Sourcetrail is a free and open-source cross-platform source explorer that helps you get productive on unfamiliar source code.
%prep
%autosetup -p1 -n Sourcetrail-%{version}
%build
cp %{SOURCE1} .
export PKG_CONFIG_PATH=..
%cmake -DBoost_USE_STATIC_LIBS=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_STATIC_LIBS:BOOL=ON \
%if %{without java}
-DBUILD_JAVA_LANGUAGE_PACKAGE:BOOL=OFF \
%endif
%if %{without tests}
-DBUILD_UNIT_TESTS_PACKAGE:BOOL=OFF \
%endif
-GNinja \
--preset system-ninja-release
cd ../../build/system-ninja-release
cmake --build .
%install
cd ../build/system-ninja-release
cmake --install . --prefix %{buildroot}%{_prefix}
mkdir -p %{buildroot}%{_bindir}
cd %{buildroot}%{_bindir}
ln -s ../Sourcetrail/app/Sourcetrail.sh sourcetrail
%if %{with tests}
%check
cd ../build/system-ninja-release
# this link makes the "find file infos follow symlinks" test to fail
rm test/data/FileSystemTestSuite/src/self
ctest -E "can create application instance" --output-on-failure --force-new-ctest-process
%endif
%files
%license LICENSE.txt
%doc CHANGELOG.md README.md DOCUMENTATION.md
%{_prefix}/Sourcetrail/
%{_bindir}/sourcetrail
%changelog