%bcond_with gcc
## START: Set by rpmautospec
## (rpmautospec version 0.6.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global component wallpapers-dynamic

%global somajor 5

Name:           plasma-%{component}
Version:        5.0.0
Release:        %autorelease
Summary:        Dynamic wallpaper plugin for KDE Plasma

License:        GPL-3.0-or-later AND LGPL-3.0-or-later AND BSD-3-Clause AND CC0-1.0 AND CC-BY-SA-4.0
URL:            https://github.com/zzag/plasma5-%{component}
Source0:        %{url}/archive/%{version}/plasma5-%{component}-%{version}.tar.gz

BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
BuildRequires:  qt6-qtbase-private-devel
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6Positioning)
BuildRequires:  cmake(Qt6Qml)
BuildRequires:  cmake(Qt6Quick)
BuildRequires:  cmake(Qt6Xml)
BuildRequires:  cmake(KF6Config)
BuildRequires:  cmake(KF6I18n)
BuildRequires:  cmake(KF6Package)
BuildRequires:  cmake(Plasma)
BuildRequires:  cmake(libavif)
BuildRequires:  pkgconfig(libexif)
#BuildRequires:  /usr/bin/appstreamcli

Recommends:     %{name}-builder

%description
A simple dynamic wallpaper plugin for KDE Plasma.

%package        devel
Summary:        Development headers and libraries for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
This package contains the development headers and libraries.

%package        builder
Summary:        Wallpaper builder for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    builder
Command-line utility to build dynamic wallpapers.

%package        builder-bash-completion
Summary:        Bash completion support for %{name}-builder
BuildArch:      noarch
Requires:       %{name}-builder = %{version}-%{release}
Supplements:    (%{name}-builder and bash-completion)
Requires:       bash
Requires:       bash-completion

%description    builder-bash-completion
Files needed to support bash completion.

%package        builder-fish-completion
Summary:        Fish completion support for %{name}-builder
BuildArch:      noarch
Requires:       %{name}-builder = %{version}-%{release}
Supplements:    (%{name}-builder and fish)
Requires:       fish

%description    builder-fish-completion
Files needed to support fish completion.

%package        builder-zsh-completion
Summary:        Zsh completion support for %{name}-builder
BuildArch:      noarch
Requires:       %{name}-builder = %{version}-%{release}
Supplements:    (%{name}-builder and zsh)
Requires:       zsh

%description    builder-zsh-completion
Files needed to support zsh completion.

%prep
%autosetup -n plasma5-%{component}-%{version}

%build
%if %{with gcc}
%enable_devtoolset14
export CC=gcc
export CXX=c++
%endif

%cmake
%cmake_build

%install
%cmake_install
%find_lang plasma_wallpaper_com.github.zzag.dynamic

%check
#appstreamcli validate --no-net %{buildroot}%{_datadir}/metainfo/com.github.zzag.dynamic.appdata.xml

%files -f plasma_wallpaper_com.github.zzag.dynamic.lang
%license LICENSES/*
%{_datadir}/plasma/wallpapers/com.github.zzag.dynamic/
%{_datadir}/metainfo/com.github.zzag.dynamic.appdata.xml
%{_libdir}/qt6/qml/com/github/zzag/plasma/wallpapers/dynamic/
%{_libdir}/qt6/plugins/kpackage/packagestructure/kdynamicwallpaper.so
%{_libdir}/libkdynamicwallpaper.so.%{somajor}{,.*}
%{_datadir}/wallpapers/Dynamic/

%files devel
%{_includedir}/KDynamicWallpaper/
%{_libdir}/libkdynamicwallpaper.so
%{_libdir}/cmake/KDynamicWallpaper/

%files builder
%{_bindir}/kdynamicwallpaperbuilder

%files builder-bash-completion
%{_datadir}/bash-completion/completions/kdynamicwallpaperbuilder

%files builder-fish-completion
%{_datadir}/fish/completions/kdynamicwallpaperbuilder.fish

%files builder-zsh-completion
%{_datadir}/zsh/site-functions/_kdynamicwallpaperbuilder

%changelog
## START: Generated by rpmautospec
* Thu Apr 04 2024 Jan Grulich <jgrulich@redhat.com> - 5.0.0-2
- Rebuild (qt6)

* Sat Mar 09 2024 Neal Gompa <ngompa@fedoraproject.org> - 5.0.0-1
- Rebase to 5.0.0 for Plasma 6

* Wed Jan 31 2024 František Zatloukal <fzatlouk@redhat.com> - 4.4.1-4
- Rebuilt for libavif 1.0.3

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 15 2024 Iñaki Úcar <iucar@fedoraproject.org> - 4.4.1-1
- Bump to version 4.4.1

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Apr 11 2023 Iñaki Úcar <iucar@fedoraproject.org> - 4.4.0-9
- Adapt license tag to SPDX

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Dec 01 2022 Kalev Lember <klember@redhat.com> - 4.4.0-7
- Rebuild for new libavif

* Sun Oct 23 2022 Robert-André Mauchin <zebob.m@gmail.com> - 4.4.0-6
- Rebuild for new libavif

* Sun Oct 23 2022 Robert-André Mauchin <zebob.m@gmail.com> - 4.4.0-5
- Rebuild for new libavif

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sat Jul 16 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.4.0-3
- Rebuild for new version of private API

* Thu Jun 23 2022 Robert-André Mauchin <zebob.m@gmail.com> - 4.4.0-2
- Rebuilt for new libavif

* Tue Jun 14 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.4.0-1
- Bump to version 4.4.0

* Tue May 24 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.3.1-2
- Rebuild for new version of private API

* Sat Apr 23 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.3.1-1
- Bump to version 4.3.1

* Tue Apr 12 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.3.0-1
- Bump to version 4.3.0

* Mon Apr 11 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.1.0-1
- Bump to version 4.1.0

* Sat Apr 09 2022 Neal Gompa <ngompa@fedoraproject.org> - 4.0.0-1
- Bump to version 4.0.0 final

* Mon Mar 28 2022 Iñaki Úcar <iucar@fedoraproject.org> - 4.0.0~git20220328.d37f412-1
- Bump snapshot, fixes a crash when creating a preview

* Sun Mar 27 2022 Neal Gompa <ngompa@fedoraproject.org> - 4.0.0~git20220327.ca7b129-1
- Bump to snapshot version using AVIF instead HEIF
- Modernize spec
- Add checks for appstream metainfo and desktop files

* Wed Feb 09 2022 RPM Fusion Release Engineering <sergiomb@rpmfusion.org> - 3.3.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Aug 03 2021 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 3.3.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sat Jun 05 2021 Iñaki Úcar <iucar@fedoraproject.org> - 3.3.9-1
- Update to v3.3.9

* Sat Nov 14 2020 Iñaki Úcar <iucar@fedoraproject.org> - 3.3.5-1
- Initial packaging for Fedora

## END: Generated by rpmautospec
