File crow-translate.spec of Package crow-translate

#
# spec file for package crow-translate
#
# Copyright (c) 2022 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
BuildRequires:  cmake >= 3.16.0
BuildRequires:  cmake(KF5Wayland)
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(lept)
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(tesseract) >= 4.0
BuildRequires:  update-desktop-files
Requires:       gstreamer-plugins-good
Requires:       tesseract-ocr
Recommends:     %{name}-lang
Provides:       bundled(libSingleApplication)
Provides:       bundled(libqhotkey)

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

%lang_package -n %{name} -r libqt5-qttranslations

%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=/s/$/\nX-LXQt-Need-Tray=true/' data/%{_name}.desktop.in

%build
%define __builder ninja
%cmake
%ninja_build

%install
%cmake_install
%suse_update_desktop_file -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