%global commit 999642872530179aa14f41f667f0c7cf0adb1498
%global shortcommit %(c=%{commit}; echo ${c:0:7})	
%global commit_date 20240702

Name:		gpuvis
Version:        0.1
Release:        2%{?dist}
Summary:        GPU Trace Visualizer

License:        MIT
URL:            https://github.com/mikesart/gpuvis

Source0:	com.github.%{name}.Gpuvis.desktop
Source1:	com.github.%{name}.Gpuvis.metainfo.xml
Source2:	com.github.%{name}.Gpuvis.svg

BuildRequires:  g++ gcc
BuildRequires:	rapidjson-devel
BuildRequires:  desktop-file-utils libappstream-glib
BuildRequires:  meson SDL2-devel freetype-devel gtk3-devel libstdc++-devel pkg-config git


%description
Gpuvis is a Linux GPU profiler similar to GPUView on Windows. 
It is designed to work with trace-cmd captures and help track 
down Linux gpu and application performance issues.

%prep
git clone https://github.com/mikesart/gpuvis

%build
cd gpuvis
%meson
%meson_build


%install
cd gpuvis
%meson_install

#enable desktop application
desktop-file-install                                    \
--dir=%{buildroot}%{_datadir}/applications/		\
%{SOURCE0}
mkdir -p %{buildroot}%{_metainfodir} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
install -m 755 %{SOURCE1} %{buildroot}%{_metainfodir}/%{name}.metainfo.xml
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{name}.metainfo.xml
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/com.github.%{name}.Gpuvis.svg

# Install LICENSE and README.md
mkdir -p %{buildroot}%{_docdir}/%{name}
install -m 644 LICENSE %{buildroot}%{_docdir}/%{name}/LICENSE
install -m 644 README.md %{buildroot}%{_docdir}/%{name}/README.md

%files
%license %{_docdir}/%{name}/LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/com.github.%{name}.Gpuvis.desktop
%{_datadir}/metainfo/%{name}.metainfo.xml
%{_datadir}/icons/hicolor/scalable/apps/com.github.%{name}.Gpuvis.svg
%doc %{_docdir}/%{name}/README.md



%changelog
* Mon Feb 14 2022 Dorinda Bassey <dbassey@redhat.com> - 0.1-1
- Add Icon
- Fetch upstream

* Thu Jan 27 2022 Dorinda Bassey <dbassey@redhat.com> - 0.1-1
- Add patch to handle RapidJSON dependency in meson build

* Mon Jan 24 2022 Dorinda Bassey <dbassey@redhat.com> - 0.1-1
- v0 -> v0.1.

* Wed Jan 19 2022 Dorinda Bassey <dbassey@redhat.com> - 0-1
- fix Makefile Upstream, remove ppc64le support
- Use meson build
- Update Sources

* Wed Jan 19 2022 Dorinda Bassey <dbassey@redhat.com> - 0-1
- Add support for ppc64le in Makefile

* Tue Jan 18 2022 Dorinda Bassey <dbassey@redhat.com> - 0-1
- Install the Desktop file
- Exclude ppc64le because -march=native option in makefile not supported on powerpc
- Fix Version

* Thu Jan 13 2022 Dorinda Bassey <dbassey@redhat.com> - 0-1
- Initial Packaged Version
- Created Install path