File crow-translate.spec of Package crow-translate

#
# spec file for package crow-translate
#
# Copyright (c) 2020 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  _ver1  1.3.1
%define  _ver2  1.4.1
%define  _ver3  2.0.1
%define  _ver4  3.1.4
%define  _name  io.crow_translate.CrowTranslate
Name:           crow-translate
Version:        2.5.1
Release:        0
Summary:        A simple and lightweight translator
License:        GPL-3.0-only
Group:          Productivity/Office/Dictionary
URL:            https://crow-translate.github.io
Source0:        %{name}-%{version}.tar.gz
# QOnlineTranslator is licensed under GPL-3.0
# https://github.com/crow-translate/QOnlineTranslator/archive/%%{_ver1}.tar.gz
Source1:        QOnlineTranslator-%{_ver1}.tar.gz
# QHotkey is licensed under BSD-3-Clause
# https://github.com/Skycoder42/QHotkey/archive/%%{_ver2}.tar.gz
Source2:        QHotkey-%{_ver2}.tar.gz
# QTaskbarControl is licensed under BSD-3-Clause
# https://github.com/Skycoder42/QTaskbarControl/archive/%%{_ver3}.tar.gz
Source3:        QTaskbarControl-%{_ver3}.tar.gz
# SingleApplication is licensed under MIT
# https://github.com/itay-grudev/SingleApplication/archive/v%%{_ver4}.tar.gz
Source4:        SingleApplication-%{_ver4}.tar.gz
BuildRequires:  cmake >= 3.14.0
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  update-desktop-files
Requires:       gstreamer-plugins-good
Recommends:     %{name}-lang

%description
Crow Translate is a simple and lightweight translator programmed in
C++ / Qt that allows to translate and speak text using Google, Yandex and
Bing translate API.

%lang_package

%prep
%setup -q -a1 -a2 -a3 -a4
sed -i "/set_target_properties/s/crow/%{name}/" CMakeLists.txt
sed -i "/APPLICATION_NAME/s/Crow\ Translate/%{name}/" CMakeLists.txt
sed -i "0,/Exec=/s/\(Exec=\).*/\1%{name}/" data/%{_name}.desktop
sed -i '/^Categories=/s/$/\nX-LXQt-Need-Tray=true/' data/%{_name}.desktop
mv QOnlineTranslator-%{_ver1}/* src/qonlinetranslator/
mv QHotkey-%{_ver2}/* src/third-party/qhotkey/
mv QTaskbarControl-%{_ver3}/* src/third-party/qtaskbarcontrol/
mv SingleApplication-%{_ver4}/* src/third-party/singleapplication/

%build
%cmake \
    -DBUILD_SHARED_LIBS:BOOL=OFF \
    -DBUILD_STATIC_LIBS:BOOL=ON
%make_build

%install
%cmake_install
%suse_update_desktop_file -r %{_name} Office Dictionary
rm -rfv %{buildroot}%{_datadir}/icons/hicolor/{310x310,150x150,44x44}

%find_lang %{name} --with-qt

%files
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{_datadir}/icons/hicolor/*/status/%{name}-tray-*.??g
%license COPYING

%files lang -f %{name}.lang
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/%{name}
%dir %{_datadir}/%{name}/%{name}/translations

%changelog
openSUSE Build Service is sponsored by