File puzzles.spec of Package puzzles

#
# spec file for package puzzles
#
# Copyright (c) 2020 SUSE LLC
#
# 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.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           puzzles
Version:        20200610.9aa7b7c
Release:        0
Summary:        Portable Puzzle Collection
License:        MIT
Group:          Amusements/Games/Logic
URL:            https://www.chiark.greenend.org.uk/~sgtatham/puzzles
Source:         %{name}-%{version}.tar.gz
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gtk+-3.0)

%description
Simon Tatham's Portable Puzzle Collection.

%prep
%autosetup

%build
%configure --program-prefix="sgt-"
%make_build

%install
%make_install

grep -A1 -h '!begin >gamedesc\.txt' *.R | sed -n -e '2~3p' > gamedesc.txt
for i in $(awk -F\: '{print $1}' gamedesc.txt); do
    for j in 16 32 48 96; do
        install -Dm 0644 icons/$i\-$j\d24.png %{buildroot}%{_datadir}/icons/hicolor/$j\x$j/apps/sgt-$i\.png
    done
    N=$(grep -w ^$i gamedesc.txt | awk -F\: '{print $3}')
    G=$(grep -w ^$i gamedesc.txt | awk -F\: '{print $4}')
    C=$(grep -w ^$i gamedesc.txt | awk -F\: '{print $5}')
    %suse_update_desktop_file -c sgt-$i "${N}" "${G}" sgt-$i sgt-$i
    %suse_update_desktop_file -r -C "${C}" sgt-$i Game LogicGame
done

%files
%license LICENCE
%doc README %{name}.txt
%{_bindir}/sgt-*
%{_datadir}/applications/sgt-*.desktop
%{_datadir}/icons/hicolor/*/apps/sgt-*.??g

%changelog
openSUSE Build Service is sponsored by