File crow-translate.spec of Package crow-translate
%if 0%{?fedora}
%bcond onnxruntime 1
%else
%bcond onnxruntime 0
%endif
%global appid org.kde.CrowTranslate
Name: crow-translate
Version: 4.0.2
Release: 0%{?dist}
Summary: Application to translate and speak text
# The entire source code is GPL-3.0-only except bundled libs:
# GPL-3.0-or-later: qonlinetranslator
# BSD-3-Clause: qhotkey
# qtaskbarcontrol
# singleapplication
# MIT: singleapplication
License: GPL-3.0-only AND GPL-3.0-or-later AND BSD-3-Clause AND MIT
URL: https://apps.kde.org/crowtranslate
Source: https://download.kde.org/stable/%{name}/%{version}/%{name}-%{version}.tar.gz
BuildRequires: desktop-file-utils
BuildRequires: dos2unix
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: extra-cmake-modules
BuildRequires: cmake(Qt6Widgets)
BuildRequires: cmake(Qt6Multimedia)
BuildRequires: cmake(Qt6Network)
BuildRequires: cmake(Qt6LinguistTools)
BuildRequires: cmake(Qt6Concurrent)
BuildRequires: cmake(Qt6StateMachine)
BuildRequires: cmake(Qt6TextToSpeech)
BuildRequires: cmake(Qt6DBus)
BuildRequires: cmake(KWayland)
%if 0%{?suse_version}
BuildRequires: appstream-glib
BuildRequires: pkgconfig(tesseract)
BuildRequires: pkgconfig(lept)
%elif 0%{?fedora}
BuildRequires: libappstream-glib
BuildRequires: cmake(tesseract)
BuildRequires: cmake(leptonica)
%endif
%if %{with onnxruntime}
BuildRequires: pkgconfig(libonnxruntime)
%endif
# Requires: hicolor-icon-theme
Recommends: gstreamer-plugins-good
Provides: bundled(espeak-ng)
Provides: bundled(qonlinetranslator)
Provides: bundled(qhotkey)
Provides: bundled(qtaskbarcontrol)
Provides: bundled(singleapplication)
%description
Application written in C++ / Qt that allows you to translate and speak text using Mozhi.
Features:
- Multiple translation engines provided by Mozhi (some instances can disable specific engines)*
- Translate and speak text from screen or selection
- Highly customizable shortcuts
- Command-line interface with rich options
- D-Bus API
- Available for Linux and Windows
* While Mozhi acts as a proxy to protect your privacy, the third-party services it uses may store and analyze the text you send.
%prep
%autosetup -n %{name}
dos2unix cmake/*.cmake src/*.cpp
# Unbundle
# * Used only on Windows
rm -r src/qgittag
%build
cmake \
-B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
%{!?with_onnxruntime:-DWITH_PIPER_TTS:BOOL=OFF}
# -DBUILD_SHARED_LIBS:BOOL=OFF \
make %{_smp_mflags} -C build
%install
%cmake_install
%find_lang %{name} --with-qt
%check
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/%{appid}.metainfo.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/%{appid}.desktop
%files -f %{name}.lang
%license LICENSES/*
%doc README.md
%{_bindir}/crow
%{_datadir}/applications/%{appid}.desktop
%{_datadir}/icons/hicolor/*/*/*.png
%{_datadir}/icons/hicolor/scalable/*/*.svg
%{_datadir}/metainfo/%{appid}.metainfo.xml
%if %{with onnxruntime}
%{_datadir}/%{name}
%endif
%changelog