File kvantum.spec of Package kvantum

#
# spec file for package kvantum
#
# 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}" == ""
ExclusiveArch:  do_not_build
%endif
%if "%{flavor}" == "qt6"
%define qt6 1
%define pkg_suffix 6
%define dsc_suffix Qt6
%endif
%if "%{flavor}" == "qt5"
%define qt5 1
%define pkg_suffix 5
%define dsc_suffix Qt5
%endif
Name:           kvantum
Version:        @SERVICE@
Release:        0
Summary:        SVG-based theme engine for Qt5 and Qt6
License:        GPL-3.0-or-later
Group:          System/GUI/KDE
URL:            https://github.com/tsujan/Kvantum
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
%if 0%{?qt5}
BuildRequires:  libQt5PlatformHeaders-devel
BuildRequires:  cmake(KF5WindowSystem)
BuildRequires:  cmake(Qt5Core) >= 5.15
BuildRequires:  cmake(Qt5Gui)
%if 0%{?sle_version}
BuildRequires:  cmake(Qt5LinguistTools)
%endif
BuildRequires:  cmake(Qt5Svg)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  cmake(Qt5X11Extras)
%endif
%if 0%{?qt6}
#%%if 0%%{?suse_version} > 1699
BuildRequires:  cmake(KF6WindowSystem)
#%%endif
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Svg)
%endif

%description
Kvantum is an SVG-based theme engine for Qt, tuned to Plasma and LXQt, with
an emphasis on elegance, usability and practicality. Its homepage is
https://github.com/tsujan/Kvantum.
Kvantum also comes with extra themes that can be selected and activated by
using Kvantum Manager.
This package provides Kvantum theme engine for %{dsc_suffix}.

%lang_package -n %{name}-manager

%package -n %{name}%{?pkg_suffix}-style
Summary:        %{dsc_suffix} Style Plugins

%description -n %{name}%{?pkg_suffix}-style
This package contains additional style plugins.

%package manager
Summary:        GUI for installing, selecting and manipulating Kvantum themes
Requires:       %{name}%{?pkg_suffix}-style = %{version}
Requires:       %{name}-themes = %{version}
Provides:       %{name}

%description manager
This package provides configuration manager - GUI appligation for
installing, selecting and manipulating Kvantum themes.

%package doc
Summary:        Documentation for Kvantum engine
Group:          Documentation/Howto
BuildArch:      noarch

%description doc
This package provides instructions on how to change configuration or make
new themes for Kvantum engine.

%package themes
Summary:        Themes for Kvantum engine
BuildArch:      noarch

%description themes
This package provides extra themes for Kvantum engine.

%prep
%autosetup

%build
%if 0%{?qt5}
%cmake \
    -DENABLE_QT5=ON
%cmake_build
%endif
%if 0%{?qt6}
%if 0%{?suse_version} > 1699
%cmake_qt6
%else
%cmake_qt6 \
    -DWITHOUT_KF=ON
%endif
%{qt6_build}
%endif

%install
%if 0%{?qt5}
%cmake_install
%endif
%if 0%{?qt6}
%{qt6_install}
%endif

%if 0%{?suse_version} && 0%{?qt6}
%fdupes -s %{buildroot}%{_datadir}/
%suse_update_desktop_file -r %{name}manager Utility Settings DesktopSettings X-XFCE-SettingsDialog X-XFCE-PersonalSettings X-GNOME-PersonalSettings
%find_lang %{name} --with-qt --all-name
%endif

%files -n %{name}%{?pkg_suffix}-style
%dir %{_libdir}/%{flavor}/plugins/styles
%{_libdir}/%{flavor}/plugins/styles/lib%{name}.so

%if 0%{?qt6}
%files manager
%doc ChangeLog NEWS README.md
%{_bindir}/%{name}*
%{_datadir}/applications/%{name}manager.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.svg
%license COPYING

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

%files doc
%doc doc/*

%files themes
%dir %{_datadir}/color-schemes/
%{_datadir}/color-schemes/*
%{_datadir}/Kvantum
%endif

%changelog
openSUSE Build Service is sponsored by