%define debug_package %{nil}
%define _build_id_links none
%define _disable_source_fetch 0

%define _name cyber-qt-plugins

%define base_ver %(curl -fsSL https://git.omame.tech/CyberOS/cyber-build-scripts/raw/branch/master/stable/%{_name}/PKGBUILD | grep pkgver | cut -d '=' -f 2 | head -n1)
%define git_refspec %(curl -fsSL -X GET "https://git.omame.tech/api/v1/repos/CyberOS/%{_name}/commits" -H  "accept: application/json" | jq -r '.[0].sha')
%define git_refspec_short %(echo %{git_refspec} | cut -c -7)
%define build_timestamp %(date +%s)

Name: %{_name}
#Version: 1.1.0
Version: %{base_ver}git.%{build_timestamp}.%{git_refspec_short}
Release: 0%{?dist}
BuildRequires: jq
Summary:	Qt Plugins necessary for Cyber Desktop to work
License:	GPLv3+
URL:		https://getcyberos.org
BuildRequires:	cmake pkgconfig
BuildRequires:	extra-cmake-modules 
BuildRequires:	libqtxdg-devel libxcb-devel xcb-util-wm-devel
BuildRequires:	cmake(Qt5Core) cmake(Qt5Widgets) cmake(Qt5DBus) cmake(Qt5X11Extras) cmake(Qt5Gui) cmake(dbusmenu-qt5) cmake(Qt5ThemeSupport)
BuildRequires:	cmake(KF5WindowSystem)
BuildRequires:	qt5-qtbase-static qt5-qtbase-private-devel

#Source0:	https://git.omame.tech/CyberOS/cyber-qt-plugins/archive/%{version}.tar.gz 
Source0: https://git.omame.tech/CyberOS/%{name}/archive/%{git_refspec}.tar.gz
%description
This package contains the Qt plugins necessary to make Cyber Desktop work

%prep
%setup -qn %{name}

%build
%{set_build_flags}
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
%make_install

%files 
%license LICENSE
%{_libdir}/qt5/plugins/platformthemes/libcyberplatformtheme.so
%{_libdir}/qt5/plugins/styles/libcyberstyle.so

%changelog
* Tue Aug 03 2021 korewaChino <crkza1134@gmail.com> - 1.0.0
- Initial version