# comment out if not snapshot
%global gitdate 20231027
%global commit0 0f5dea06fa62062c7e98b36945a63aae7835a80a
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})

%global _iconsdir %{_datadir}/icons

Name:       hardinfo
Version:    0.6
Release:    2%{?shortcommit0:.%{gitdate}git%{shortcommit0}}%{?dist}
Summary:    A system profiler for Linux
License:    GPLv2+
Group:      System/Kernel and hardware
Url:        http://hardinfo.org
Source0:    https://github.com/lpereira/hardinfo/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz
Patch1:     hardinfo-0.6-fix-function-declarations.patch
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  pciutils
BuildRequires:  pkgconfig(json-glib-1.0)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  gtk3-devel
BuildRequires:  pkgconfig(zlib)
BuildRequires:  desktop-file-utils
BuildRequires:  lm_sensors-devel
BuildRequires:  libtasn1-devel
BuildRequires:  libffi-devel
BuildRequires:  libselinux-devel
BuildRequires:  libmount-devel
Requires:   pciutils
Requires:   glx-utils

%description
HardInfo is a system profiler for Linux systems.
It can display information about the hardware, software, and perform
simple benchmarks.

%prep
%autosetup -p1 -n %{name}-%{?gitdate:%commit0}%{?!gitdate:%version}

%build
%cmake \
     -DCMAKE_INSTALL_LIBDIR=%{_lib} \
     -DCMAKE_BUILD_TYPE=Release \
     -DHARDINFO_GTK3=ON \
%cmake_build

%install
%cmake_install

desktop-file-install --vendor="" \
  --set-generic-name='Hardware Information' \
  --set-comment='System Information' \
  --remove-category="Application" \
  --add-category="Settings;HardwareSettings;" \
  --dir %{buildroot}%{_datadir}/applications %{buildroot}%{_datadir}/applications/%{name}.desktop

%find_lang %{name}

%files -f %{name}.lang
%{_bindir}/%{name}
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_iconsdir}/hicolor/*/apps/hardinfo.png
%{_mandir}/man1/hardinfo.1*

%changelog