File srb2kart.spec of Package srb2kart

#
# spec file for package srb2kart
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2019-2020, Martin Hauke <mardnh@gmx.de>
#
# 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/
#


%define sversion 16
Name:           srb2kart
Version:        1.6
Release:        0
Summary:        Sonic Robo Blast 2 Kart
License:        GPL-2.0-or-later
Group:          Amusements/Games/3D/Other
URL:            https://www.srb2.org
#Git-Clone:     https://github.com/STJr/Kart-Public.git
Source:         https://github.com/STJr/Kart-Public/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://github.com/STJr/Kart-Public/releases/download/v%{version}/srb2kart-v%{sversion}-Installer.exe
BuildRequires:  ImageMagick
BuildRequires:  cmake
BuildRequires:  hicolor-icon-theme
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  unrar
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libgme)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)
ExclusiveArch:  %{ix86} x86_64
%if 0%{?suse_version} <= 1500
# python3-setuptools is needed for unrar on <= Leap 15.2 (bsc#1170792)
BuildRequires:  python3-setuptools
%endif

%description
SRB2Kart is a classic styled kart racer, complete with beautiful courses,
and wacky items. Of course, because it’s SRB2Kart, it has a Sonic twist
that really shows the classic charm that a lot of us know and love from
the good old days™.

%package data
Summary:        Architecture independent data for srb2kart
Group:          Amusements/Games/3D/Other
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
This package contains the game data for srb2kart.
It is required to play the game.

%prep
%setup -q -n Kart-Public-%{version}
unrar x %{SOURCE1} ./assets/installer/
find . -name *.c -exec sed -i 's|%{_prefix}/games/SRB2Kart|%{_datadir}/srb2kart|g' {} \;

%build
%cmake
%make_jobs

%install
install -D -m 0775 build/bin/srb2kart %{buildroot}/%{_bindir}/srb2kart
install -d %{buildroot}/%{_datadir}/srb2kart/
install -m 0644 assets/installer/*.{kart,srb} %{buildroot}/%{_datadir}/srb2kart/

# Install icons and desktop file
for size in 256 128 96 64 48 32 16; do
    mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$size"x$size/apps"
    convert -strip srb2.png -resize "$size"x"$size" %{buildroot}%{_datadir}/icons/hicolor/$size"x$size/apps/%{name}.png"
done
%suse_update_desktop_file -c %{name} "Sonic Robo Blast 2 Kart" %{name} %{name} %{name} Game ArcadeGame

%files
%doc README.md
%license assets/LICENSE*.txt
%{_bindir}/srb2kart
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

%files data
%{_datadir}/srb2kart/

%changelog
openSUSE Build Service is sponsored by