File speed-dreams.spec of Package speed-dreams

#
# spec file for package speed-dreams
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2008-2012 Jean-Philippe Meuret aka pouillot
# & Bertaux Xavier aka torcs-ng (GPLv2 & GPLv3)
#
# 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 rev r8786
Name:           speed-dreams
Version:        2.3.0
Release:        0
Summary:        Car motorsport simulation
License:        GPL-2.0-or-later AND SUSE-Free-Art-1.3
Group:          Amusements/Games/3D/Race
URL:            https://speed-dreams.net
Source2:        https://downloads.sf.net/%{name}/%{name}-src-base-%{version}-%{rev}.tar.xz
Source3:        https://downloads.sf.net/%{name}/%{name}-src-hq-cars-and-tracks-%{version}-%{rev}.tar.xz
Source4:        https://downloads.sf.net/%{name}/%{name}-src-more-hq-cars-and-tracks-%{version}-%{rev}.tar.xz
Source5:        https://downloads.sf.net/%{name}/%{name}-src-wip-cars-and-tracks-%{version}-%{rev}.tar.xz
Source6:        https://downloads.sf.net/%{name}/%{name}-src-unmaintained-%{version}-%{rev}.tar.xz
# PATCH-FIX-SUSE -- use gcc builtins for atomic operations on all architectures
Patch0:         use_gcc_builtins_for_all_archs.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  freeglut-devel
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  pkgconfig
BuildRequires:  plib-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(freealut)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(openscenegraph) >= 3.4
BuildRequires:  pkgconfig(openthreads) >= 3.2
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xmu)
BuildRequires:  pkgconfig(zlib)
Requires:       %{name}-data = %{version}

%description
Speed Dreams ia a fork of the racing car simulator Torcs,
with new features:
* new car sets: Super Cars, 36 GP, LS-GT1
* updated TBR1 car set
* a few new tracks
* Simu V3 physics engine

%package data
Summary:        Game data for Speed Dreams
Group:          Amusements/Games/3D/Race
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Speed Dreams ia a fork of the racing car simulator Torcs,
with some new features.

This subpackage contains the game data, such as textures, sounds,
maps, and so on.

%package        devel
Summary:        Development files for Speed Dreams
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}
BuildArch:      noarch

%description    devel
Include files for development of so-called robots in Speed Dreams.

%prep
%setup -Tc -a2 -a3 -a4 -a5 -a6
%patch -P0 -p0
chmod -x *.txt

%build
mkdir -p build
cd build
cmake .. \
       -DOPTION_OFFICIAL_ONLY:BOOL=ON \
       -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=FALSE \
       -DCMAKE_C_FLAGS="%{optflags}" \
       -DCMAKE_CXX_FLAGS="%{optflags}" \
       -DSD_BINDIR:PATH=bin \
       -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix}
%make_build BINDIR=%{_bindir}

%install
# Fixup driver library clones
# https://sourceforge.net/p/speed-dreams/tickets/1227/
(cd %{__builddir}/%{_lib}/games/speed-dreams-2/drivers/
for d in *_*; do
    cmp ${d%_*}/${d%_*}.so ${d}/${d}.so && ln -sf ../${d%_*}/${d%_*}.so ${d}/${d}.so
done)

%cmake_install
# Let's use %%doc macro.
rm %{buildroot}%{_datadir}/games/%{name}-2/*.txt
%suse_update_desktop_file -c %{name} "Speed Dreams" "Racing car simulator" "%{name}-2" %{name} "Game;Simulation;"
mkdir -p %{buildroot}%{_datadir}/pixmaps
install -m644 data/data/icons/icon.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
mkdir -p %{buildroot}%{_datadir}/metainfo
install -m644 packaging/appdata/speed-dreams-2.appdata.xml %{buildroot}%{_datadir}/metainfo/

mkdir -p %{buildroot}%{_mandir}/man6
install -m644 doc/man/sd2-accc.6 %{buildroot}%{_mandir}/man6/sd2-accc.6
install -m644 doc/man/sd2-nfs2ac.6 %{buildroot}%{_mandir}/man6/sd2-nfs2ac.6
install -m644 doc/man/sd2-nfsperf.6 %{buildroot}%{_mandir}/man6/sd2-nfsperf.6
install -m644 doc/man/sd2-trackgen.6 %{buildroot}%{_mandir}/man6/sd2-trackgen.6
install -m644 doc/man/speed-dreams-2.6 %{buildroot}%{_mandir}/man6/speed-dreams-2.6
%fdupes %{buildroot}/%{_datadir}
%fdupes %{buildroot}/%{_libdir}

%files
%license COPYING.txt
%doc CHANGES.txt README.txt
%doc doc/faq/faq.html doc/userman
%{_mandir}/man6/*
%{_bindir}/sd2*
%{_bindir}/%{name}*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/*.appdata.xml
%{_datadir}/pixmaps/%{name}.png
%dir %{_libdir}/games
%{_libdir}/games/%{name}-2/

%files data
%{_datadir}/games/%{name}-2/

%files devel
%{_includedir}/%{name}-2/

%changelog
openSUSE Build Service is sponsored by