File srb2.spec of Package srb2

#
# spec file for package srb2
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2019-2021, 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/
#


Name:           srb2
Version:        2.2.15
Release:        0
Summary:        A 3D Sonic fan game based off of Doom Legacy (aka "Sonic Robo Blast 2")
License:        GPL-2.0-or-later
Group:          Amusements/Games/3D/Other
URL:            http://www.srb2.org
Source:         https://github.com/STJr/SRB2/archive/SRB2_release_%{version}.tar.gz
Source1:        https://github.com/STJr/SRB2/releases/download/SRB2_release_%{version}/SRB2-v2215-Full.zip
BuildRequires:  ImageMagick
BuildRequires:  ccache
BuildRequires:  cmake
BuildRequires:  hicolor-icon-theme
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  unzip
BuildRequires:  gcc-c++
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libgme)
BuildRequires:  pkgconfig(libopenmpt)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)
Requires:       %{name}-data = %{version}-%{release}
ExclusiveArch:  %{ix86} x86_64

%description
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
the design in 3D. It features tons of levels, enemies, speed,
and quite a lot of the fun that the original Sonic games provided.

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

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

%prep
%setup -q -n SRB2-SRB2_release_%{version}
unzip -d ./assets/installer/ %{SOURCE1}
find . -name *.c -exec sed -i 's|%{_prefix}/games/SRB2|%{_datadir}/srb2|g' {} \;
sed -i 's/\r$//' assets/LICENSE*

%build
make clean
%ifarch %{ix86}
make -C src/ LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS= NOUPNP=1 CCACHE=1
%else
make -C src/ LINUX64=1 LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS= NOUPNP=1 CCACHE=1
%endif
%make_jobs

%install
install -D -m 0775 bin/lsdl2srb2 %{buildroot}/%{_bindir}/srb2
install -d %{buildroot}/%{_datadir}/srb2/
install -m 0644 assets/installer/*.pk3 %{buildroot}/%{_datadir}/srb2/

# 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" "A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis." %{name} %{name} Game ArcadeGame

%if 0%{?suse_version} < 1330
%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

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

%files data
%{_datadir}/srb2/

%changelog
openSUSE Build Service is sponsored by