File crow-translate.spec of Package crow-translate

#
# spec file for package crow-translate
#
# Copyright (c) 2025 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 https://bugs.opensuse.org/
#


%define  _name  org.kde.CrowTranslate
Name:           crow-translate
Version:        @SERVICE@
Release:        0
Summary:        A simple and lightweight translator
License:        GPL-3.0-or-later AND CC-BY-SA-4.0 AND CC0-1.0
Group:          Productivity/Office/Dictionary
URL:            https://apps.kde.org/ru/crowtranslate
Source0:        %{name}-%{version}.tar.xz
Patch0:         russian-translation-desktop-file.patch
BuildRequires:  cmake >= 3.16.0
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  kf6-extra-cmake-modules
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Multimedia)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6StateMachine)
BuildRequires:  cmake(Qt6TextToSpeech)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  pkgconfig(KWaylandClient)
BuildRequires:  pkgconfig(tesseract) >= 4.0
BuildRequires:  pkgconfig(xcb)
Requires:       gstreamer-plugins-good
Requires:       tesseract-ocr
Recommends:     %{name}-lang
Suggests:       espeak-ng
Suggests:       speech-dispatcher-module-espeak
Provides:       bundled(libSingleApplication) = 3.6.0
Provides:       bundled(libqhotkey) = 1.5.0

%description
Crow Translate is a translator written in C++ / Qt that allows you to
translate and speak text using Mozhi.

%lang_package

%prep
%autosetup -p1
sed -i "/APPLICATION_NAME/s/Crow\ Translate/%{name}/" CMakeLists.txt
sed -i "/EXECUTABLE_NAME/s/crow/%{name}/" CMakeLists.txt
sed -i "0,/Exec=/s/\(Exec=\).*/\1%{name}/" data/%{_name}.desktop.in
sed -i '/^Categories=/a\X-LXQt-Need-Tray=true' data/%{_name}.desktop.in

%build
%cmake_qt6 \
    -DWITH_PIPER_TTS=OFF \
    -DQT_DEFAULT_MAJOR_VERSION=6 \
    -DCMAKE_POLICY_VERSION_MINIMUM=3.5
%qt6_build

%install
%qt6_install
%suse_update_desktop_file -n -r %{_name} Office Dictionary

%find_lang %{name} --with-qt

%files
%doc README.md
%{_bindir}/%{name}
%{_datadir}/metainfo/%{_name}.metainfo.xml
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{_name}.??g
%{_datadir}/icons/hicolor/*/status/%{_name}-tray-*.??g
%license LICENSES/{CC0-1.0.txt,CC-BY-SA-4.0.txt,GPL-3.0-or-later.txt}

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by