File JS8Call-improved.spec of Package JS8Call-improved

#
# spec file for package JS8Call-improved
#
# Copyright (c) 2026 Markus Kolb <opensuse.org@tower-net.de>
#
# 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.

%define build_tar_ball 0

Name:           JS8Call-improved
Version:        2.6.0
Release:        0
Summary:        Weak signal keyboard-to-keyboard messaging for radio frequency
License:        GPL-3.0-only
Group:          Productivity/Hamradio/Other
Url:            https://github.com/JS8Call-improved/JS8Call-improved
%if %{build_tar_ball}
Source0:        %{name}-%{version}.tar.xz
%else
Source0:        _service
%endif

BuildRequires:  cmake
BuildRequires:  fftw3-threads-devel
BuildRequires:  libboost_thread-devel >= 1.77
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt6Concurrent)
BuildRequires:  pkgconfig(Qt6Multimedia)
BuildRequires:  pkgconfig(Qt6SerialPort)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(hamlib)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(sqlite3)

%description
JS8Call started as an experiment in combining the robustness of FT8
(a weak-signal mode by K1JT) with a messaging and network protocol layer
for weak signal communication.

It is designed for connecting amateur radio operators who are operating 
under weak signal conditions and offers real-time keyboard-to-keyboard 
messaging, stored (inbox) messaging, message relay, and automatic station 
announcements.

%prep
%if %{build_tar_ball}
 %setup -q
%else
 %setup -q -n %_sourcedir/%name-%version -T -D
%endif
build_ver=$(echo %version | sed 's/^\(.*\)~git.*\.\(.*\)$/~git\2/')
sed -i \
    -e "s/WSJTX_VERSION_PATCH \([0-9]*\)/WSJTX_VERSION_PATCH \1$build_ver/" \
    -e 's/WSJTX_VERSION_IS_RELEASE 0/WSJTX_VERSION_IS_RELEASE 1/' \
    %_sourcedir/%name-%version/Versions.cmake
sed -i \
    -e 's/^Name=.*$/Name=JS8Call-improved/' \
    -e 's/^Exec=.*$/Exec=JS8Call-improved/' \
    -e 's/^Icon=.*$/Icon=JS8Call-improved/' \
    -e 's/^Categories=.*$/Categories=Network;HamRadio;/' \
    %_sourcedir/%name-%version/.github/workflows/misc/JS8Call.desktop
sed -i \
    -e '/^find_package(Qt6/a find_package(SQLite3)' \
    -e '/include_directories(${FFTW3_/a\
include_directories(${SQLite3_INCLUDE_DIRS})\
if(NOT TARGET SQLite3::SQLite3)\
  add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)\
endif()\
set(CMAKE_EXE_LINKER_FLAGS "-s")
' \
    -e 's/set(TARGET ${PROJECT_NAME})/set(TARGET ${PROJECT_NAME}-improved)/' \
    -e 's/ vendor\/sqlite3\/sqlite3.c/ #vendor\/sqlite3\/sqlite3.c/' \
    -e '
/^target_link_libraries(/,/^)/{
  /^[[:space:]]*${FFTW3_LIBRARIES}[[:space:]]*$/a\
  SQLite3::SQLite3
}
' \
    %_sourcedir/%name-%version/CMakeLists.txt

%build
%cmake
%cmake_build

%install
install -D build/%{name} %{buildroot}%{_bindir}/%{name}
install -Dm 644 README.md %{buildroot}%{_docdir}/%{name}/README.md
install -Dm 644 LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE
install -Dm 644 .github/workflows/misc/JS8Call.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644 icons/Unix/js8call_icon.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

%files
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*
%dir %{_licensedir}/%{name}
%license %{_licensedir}/%{name}/LICENSE
%{_bindir}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog
openSUSE Build Service is sponsored by