File stuntrally.spec of Package stuntrally

#
# spec file for package stuntrally
#
# Copyright (c) 2021 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:           stuntrally
Version:        2.6.1
Release:        0
Summary:        Rally game with stunt elements
License:        GPL-3.0-only
Group:          Amusements/Games/Action/Race
URL:            https://stuntrally.tuxfamily.org
Source0:        https://github.com/stuntrally/stuntrally/archive/%{version}/stuntrally-%{version}.tar.gz
Source1:        https://github.com/stuntrally/tracks/archive/%{version}/tracks-%{version}.tar.gz
Source8:        sr-editor.6
Source9:        stuntrally.6
# PATCH-FIX-UPSTREAM strcmp.diff -- use strcmp to compare c-strings
Patch0:         strcmp.diff
# PATCH-FIX-UPSTREAM stuntrally-master.patch adam@mizerski.pl -- Output of `git diff 2.6.1..master`. Master branch currently contains only bugfixes and compatibility updates.
Patch1:         stuntrally-master.patch
# PATCH-FIX-UPSTREAM stuntrally-ogre.patch adam@mizerski.pl https://github.com/stuntrally/stuntrally/pull/37 -- Compatibility with newer Ogre.
Patch2:         stuntrally-ogre.patch
# PATCH-FIX-UPSTREAM stuntrally-cpp.patch adam@mizerski.pl https://github.com/stuntrally/stuntrally/pull/35 -- C++17 added `std::optional` type. The code contains it's own optional and `using namespace std;` causing a collision.
Patch3:         stuntrally-cpp.patch
# PATCH-FIX-UPSTREAM stuntrally-float.patch adam@mizerski.pl https://github.com/stuntrally/stuntrally/pull/36 -- btScalar has changed it's type. Resolve error in calling `std::min(double, float)`.
Patch4:         stuntrally-float.patch
BuildRequires:  cmake >= 3
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
# cmake does not find the correct plugin path without
BuildRequires:  libOgreMain-plugins
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libboost_wave-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(MYGUI)
BuildRequires:  pkgconfig(OGRE)
BuildRequires:  pkgconfig(OGRE-Bites)
BuildRequires:  pkgconfig(OGRE-Overlay)
BuildRequires:  pkgconfig(OGRE-Paging)
BuildRequires:  pkgconfig(OGRE-Property)
BuildRequires:  pkgconfig(OGRE-RTShaderSystem)
BuildRequires:  pkgconfig(OGRE-Terrain)
BuildRequires:  pkgconfig(OIS)
BuildRequires:  pkgconfig(bullet) >= 2.83
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(vorbisfile)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcursor)
Requires:       %{name}-data = %{version}
# cg seems to be unnecessary
Suggests:       %( echo libOgreMain$(pkg-config --modversion OGRE)-plugin-Cg | sed 's/\./_/g' )

%description
Stunt Rally is a car simulation using VDrift and libbullet.
Rendering is achieved by OGRE. Trees/grass by PagedGeometry,
user interface by MyGUI, materials are managed by shiny.
The road is based on a 3D spline and is fully customizable
in the track editor.

The game focuses on closed rally tracks with possible stunt
elements (jumps, loops, pipes).

%package data
Summary:        Data files for Stunt Rally
Group:          Amusements/Games/Action/Race
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Architecture independent data files for Stunt Rally.

%prep
%setup -q -a1
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
mv tracks-%{version} data/tracks

%build
# -DBT_USE_DOUBLE_PRECISION should be discovered by cmake from bullet config, but it's not.
export CFLAGS="%{optflags} -fno-strict-aliasing -fpermissive -DBT_USE_DOUBLE_PRECISION"
export CXXFLAGS="%{optflags} -fno-strict-aliasing -fpermissive -DBT_USE_DOUBLE_PRECISION"
%cmake \
    -DBUILD_SHARED_LIBS:BOOL=OFF \
    -DBUILD_STATIC_LIBS:BOOL=ON \
    -DSHARE_INSTALL=share/stuntrally
%cmake_build

%install
%cmake_install
%fdupes %{buildroot}/%{_datadir}/stuntrally

mkdir -p %{buildroot}%{_mandir}/man6
cd %{_sourcedir}
for MANPAGE in *.?; do
  cp $MANPAGE %{buildroot}%{_mandir}/man`echo "$MANPAGE" | grep -o '[0-9]*'`
done

%files
%{_bindir}/sr-editor
%{_bindir}/stuntrally
%{_mandir}/man?/s*.?.*
%{_datadir}/applications/sr-editor.desktop
%{_datadir}/applications/stuntrally.desktop
%{_datadir}/icons/hicolor/*/apps/
%dir %{_datadir}/stuntrally/
%{_datadir}/stuntrally/config/

%files data
%{_datadir}/stuntrally/
%exclude %{_datadir}/stuntrally/config/

%changelog
openSUSE Build Service is sponsored by