File ClamAV-GUI.spec of Package ClamAV-GUI

#
# spec file for package clamav-gui
#
# Copyright (c) 2024 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/
#


%global flavor @BUILD_FLAVOR@%{nil}

%if "%{flavor}" == "qt6"
%define build_qt5 0
%define build_qt6 1
%define name_suffix -qt6
%else
%define build_qt5 1
%define build_qt6 0
%define name_suffix -qt5
%endif
%define sname clamav-gui

Name:           ClamAV-GUI%{name_suffix}
Version:        1.1.6
Release:        0
Summary:        Front-End for ClamAV
License:        GPL-3.0-only
Group:          Productivity/Security
URL:            https://www.opencode.net/wusel1007/clamav-gui
Source0:        %{sname}-%{version}.tar.gz
BuildRequires:  update-desktop-files
Requires:       clamav >= 0.103.11
Requires:       %{_bindir}/clamscan
Requires:       %{_bindir}/freshclam

# QT5
%if %{build_qt5}
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  cmake(Qt5Network)
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5LinguistTools)
%endif

# QT6
%if %{build_qt6}
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Core5Compat)

%endif

%description
A graphical Front-End for the ClamAV Anti-Virus Scanner. It uses freshclam as a backend for signature updates
and provides a scheduler for timed virus scanns.

%lang_package

%prep
%setup -q -n %{sname}-%{version}


%build
%if %{build_qt5}
lupdate-qt5 clamav-gui.pro
lrelease-qt5 clamav-gui.pro
%qmake5 QMAKE_CFLAGS+="%optflags" QMAKE_CXXFLAGS+="%optflags" QMAKE_STRIP="/bin/true" clamav-gui.pro
%endif
%if %{build_qt6}

sed -i -e 's|+= core gui network|+= core gui network widgets|g' clamav-gui.pro
sed -i -e 's|greaterThan(QT_MAJOR|#greaterThan(QT_MAJOR|g' clamav-gui.pro

lupdate6 clamav-gui.pro
lrelease6 clamav-gui.pro
%qmake6 QMAKE_CFLAGS+="%{optflags}" QMAKE_CXXFLAGS+="%{optflags}" QMAKE_STRIP="/bin/true" clamav-gui.pro
%endif
%make_build


%install
make install INSTALL_ROOT=%{buildroot}
##%%find_lang %%{name} --with-qt
ln -f -s %{_datadir}/clamav-gui/clamav-gui-en_GB.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-en_US.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-en_GB.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-en_AU.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-en_GB.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-en_NZ.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-en_GB.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-en_IE.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_MZ.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_MO.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_ST.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_AO.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_CV.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_TL.qm
ln -f -s %{_datadir}/clamav-gui/clamav-gui-pt_PT.qm %{buildroot}%{_datadir}/clamav-gui/clamav-gui-pt_BR.qm
mkdir -p %{buildroot}%{_mandir}/br/man1
ln -f -s %{_mandir}/pt/man1/clamav-gui.1.gz %{buildroot}%{_mandir}/br/man1/clamav-gui.1.gz
ln -f -s %{_datadir}/icons/hicolor/32x32/apps/clamav-gui.png %{buildroot}%{_datadir}/clamav-gui/clamav-gui.png


%post
%desktop_database_post


%postun
%desktop_database_postun


%files
%doc CHANGES README README.md
%doc %{_datadir}/doc/ClamAV-GUI
%dir %{_datadir}/kservices5
%dir %{_datadir}/kservices5/ServiceMenus
%dir %{_datadir}/man/br
%dir %{_datadir}/man/br/man1
%{_bindir}/clamav-gui
%{_datadir}/clamav-gui
%{_datadir}/applications/ClamAV-GUI.desktop
%{_datadir}/kservices5/ServiceMenus/ClamAV-GUI-ServiceMenu.desktop
%{_datadir}/man/br/man1/clamav-gui.1.gz
%{_datadir}/icons/hicolor/
%{_mandir}/de
%{_mandir}/en
%{_mandir}/da_DK
%{_mandir}/uk
%{_mandir}/es
%{_mandir}/fr
%{_mandir}/it
%{_mandir}/pt


%changelog
openSUSE Build Service is sponsored by