File sauerbraten.spec of Package sauerbraten
#
# spec file for package sauerbraten
#
# Copyright (c) 2024 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/
#
%define release_group 2020_11_29
Name: sauerbraten
Version: 2020_12_29
Release: 0
URL: http://sauerbraten.org/
Summary: A free multiplayer/singleplayer first person shooter
License: Zlib
Group: Amusements/Games/3D/Shoot
Source: https://sourceforge.net/projects/%{name}/files/%{name}/%{release_group}/%{name}_%{version}_linux.tar.bz2/download#/%{name}_%{version}_linux.tar.bz2
Source1: sauerbraten.desktop
BuildRequires: Mesa-devel
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRequires: pkgconfig(SDL2_image)
BuildRequires: pkgconfig(SDL2_mixer)
BuildRequires: pkgconfig(zlib)
Requires: %{name}-data = %{version}
%description
Cube 2: Sauerbraten is a free multiplayer/singleplayer first person
shooter, the successor of the Cube FPS.
Much like the original Cube, the aim of this game is fun, old school
deathmatch gameplay and also to allow map/geometry editing to be done
cooperatively in-game.
The engine supporting the game is entirely original in code & design,
and its code is Open Source (ZLIB license).
%package server
Summary: Sauerbraten standalone server
Group: Amusements/Games/3D/Shoot
%description server
Cube 2: Sauerbraten is a free multiplayer/singleplayer first person
shooter, the successor of the Cube FPS.
Much like the original Cube, the aim of this game is fun, old school
deathmatch gameplay and also to allow map/geometry editing to be done
cooperatively in-game.
The engine supporting the game is entirely original in code & design,
and its code is Open Source (ZLIB license).
This package provides the Sauerbraten standalone server.
%package data
Summary: Data files for Sauebraten
Group: Amusements/Games/3D/Shoot
Requires: %{name} = %{version}
BuildArch: noarch
%description data
Cube 2: Sauerbraten is a free multiplayer/singleplayer first person
shooter, the successor of the Cube FPS.
Much like the original Cube, the aim of this game is fun, old school
deathmatch gameplay and also to allow map/geometry editing to be done
cooperatively in-game.
The engine supporting the game is entirely original in code & design,
and its code is Open Source (ZLIB license).
This package provides the data files for Sauebraten.
%prep
%autosetup -p1 -n %{name}
%build
# bundle comes with pre-built binaries. Delete them.
rm ./bin_unix/*
# go to where the Makefile resides, clean and build
cd src
make clean
%{make_build} CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" CXXOPTFLAGS="-Wall -fsigned-char %{optflags}"
%install
cd src
%{make_install}
cd ../bin_unix
mv ./*client client
mv ./*server server
# game's make install uses custom folder scheme, so we have to fix it
mkdir -p %{buildroot}%{_libexecdir}/%{name}/bin_unix
cp -a ./* %{buildroot}%{_libexecdir}/%{name}/bin_unix/
mkdir -p %{buildroot}%{_bindir}
cat <<EOT >%{buildroot}%{_bindir}/%{name}
#!/bin/sh
CUBE_DIR=\$HOME/.cube
if test ! -e \$CUBE_DIR ; then
mkdir \$CUBE_DIR
ln -s %{_libexecdir}/%{name}/* \$CUBE_DIR
fi
cd \$CUBE_DIR
exec bin_unix/client "\$@"
EOT
chmod 755 %{buildroot}%{_bindir}/%{name}
ln -s ../..%{_libexecdir}/%{name}/bin_unix/server %{buildroot}%{_bindir}/%{name}-server
# copy data files
cp -a ../data/ ../packages/ %{buildroot}%{_libexecdir}/%{name}/
install -d %{buildroot}%{_datadir}/applications
cp %{SOURCE1} %{buildroot}%{_datadir}/applications
# fix incorrect permissions of non-executable files
chmod 644 %{buildroot}%{_libexecdir}/%{name}/packages/models/cleaner/gutter_45_big/{license.txt,obj.cfg}
%fdupes -s %{buildroot}%{_libexecdir}/%{name}/packages/
%files
%{_bindir}/%{name}
%dir %{_libexecdir}/%{name}
%dir %{_libexecdir}/%{name}/bin_unix
%{_libexecdir}/%{name}/bin_unix/client
%{_datadir}/applications/%{name}.desktop
%files server
%{_bindir}/%{name}-server
%dir %{_libexecdir}/%{name}/bin_unix
%{_libexecdir}/%{name}/bin_unix/server
%files data
%doc docs/*
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/data
%{_libexecdir}/%{name}/packages
%changelog