File simsu.spec of Package simsu

#
# spec file for package simsu
#
# Copyright (c) 2016 Graeme Gott <graeme@gottcode.org>
#
# 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.

Name:           simsu
Summary:        Basic Sudoku game
Version:        1.3.2
Release:        2
License:        GPL-3.0+
URL:            http://gottcode.org/%{name}/
Source:         %{name}-%{version}-src.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-build

# Fedora, RHEL, or CentOS
#--------------------------------------------------------------------
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
Group:          Amusements/Games
BuildRequires:  desktop-file-utils
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  qt5-qtbase-devel
%endif
#--------------------------------------------------------------------

# openSUSE or SLE
#--------------------------------------------------------------------
%if 0%{?suse_version}
Group:          Amusements/Games/Logic
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  update-desktop-files
%endif
#--------------------------------------------------------------------

%description
A basic Sudoku game. You can switch between filling in notes (pencil mode),
or filling in answers (pen mode). To make it easier to see where to place
numbers, you can highlight all instances of a number. You can also check
your answers for correctness while playing. The game stores your current
notes and answers, so that you can pick up where you left off the next
time you play.

%prep
%setup -q -n %{name}-%{version}

%build
qmake-qt5 QMAKE_CFLAGS+="%optflags" QMAKE_CXXFLAGS+="%optflags" QMAKE_STRIP="/bin/true" PREFIX=%{_prefix}
make %{?_smp_mflags}

# Fedora, RHEL, or CentOS
#--------------------------------------------------------------------
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
%install
make install INSTALL_ROOT=%{buildroot}
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop

%clean
rm -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif
#--------------------------------------------------------------------

# openSUSE or SLE
#--------------------------------------------------------------------
%if 0%{?suse_version}
%install
make install INSTALL_ROOT=%{buildroot}
%suse_update_desktop_file %{name}

%clean
rm -rf %{buildroot}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif
#--------------------------------------------------------------------

%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_datadir}/%{name}
%if 0%{?suse_version}
%{_datadir}/appdata
%endif
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%if 0%{?suse_version}
%{_datadir}/icons/hicolor/*
%{_datadir}/icons/hicolor/*/*
%endif
%{_datadir}/icons/hicolor/*/*/%{name}.*g
%{_datadir}/pixmaps/%{name}.xpm
%{_mandir}/man?/%{name}.*
%doc ChangeLog COPYING CREDITS README

%changelog
openSUSE Build Service is sponsored by