File scorched3d.spec of Package scorched3d

#
# spec file for package scorched3d
#
# Copyright (c) 2024, 2025 Boian Berberov
# Copyright (c) 2022 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/
#

%bcond_without  mesonbuildsys

%global         use_lua_ver  5.1

%global         gitref   core



Name:           scorched3d
Version:        44.2
Release:        0%{?dist}
Group:          Amusements/Games/Action/Arcade
Summary:        Game based loosely on the classic DOS game Scorched Earth
License:        GPL-2.0-or-later
# URL:            http://www.scorched3d.co.uk/
URL:            https://github.com/bberberov/%{name}

%if %{defined gitref}
Source0:        %{url}/archive/%{gitref}.tar.gz
%else
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz
%endif
Source1:        %{name}.desktop

# PATCH-FEATURE-OPENSUSE %%{name}-current-date.patch -- to prevent useless rebuilds.
Patch0:         %{name}-current-date.patch

%if 0%{with mesonbuildsys}
BuildRequires:  meson >= 0.60
%else
BuildRequires:  automake
%endif

BuildRequires:  fdupes

# BEGIN multibuild BuildRequires: GCC all
%if 0%{?is_opensuse}
	%if 0%{?sle_version} <= 150600
		%if 0%{?sle_version} == 150600
BuildRequires:  gcc13
BuildRequires:  gcc13-c++
%global         multi_gcc  gcc-13
%global         multi_gpp  gcc-13 -E
%global         multi_gxx  g++-13
		%else
			%if 0%{?sle_version} == 150500
BuildRequires:  gcc12
BuildRequires:  gcc12-c++
%global         multi_gcc  gcc-12
%global         multi_gpp  gcc-12 -E
%global         multi_gxx  g++-12
			%else
BuildRequires:  gcc     >= 10
BuildRequires:  gcc-c++ >= 10
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
			%endif
		%endif
	%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
	%endif
%else
BuildRequires:  gcc
BuildRequires:  gcc-c++
%global         multi_gcc  gcc
%global         multi_gpp  gcc -E
%global         multi_gxx  g++
%endif
# END   multibuild BuildRequires: GCC all

BuildRequires:  perl
BuildRequires:  pkgconfig

# BUG: Multilib problem on Slowroll
%if "%{_repository}" == "openSUSE_Slowroll"
BuildRequires:  SDL_net-devel
%else
BuildRequires:  pkgconfig(SDL_net)
%endif

BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(fftw3f)
BuildRequires:  pkgconfig(freealut)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glut)
BuildRequires:  pkgconfig(libjpeg)

%if 0%{?mageia} || 0%{?fedora} || 0%{?alma_linux} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires:  pkgconfig(lua-%{use_lua_ver})
%else
BuildRequires:  pkgconfig(lua%{use_lua_ver})
%endif

BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(openal) >= 1.17.2
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(zlib)

%if 0%{?mageia}
BuildRequires:  wxgtk-devel
%else
BuildRequires:  wxWidgets-devel
%endif

# configure checks for xdg-utils
BuildRequires:  xdg-utils

# Upstream naming compatibility
Provides:       Scorched3D = %{version}

%description
Scorched 3D is a game based on the classic DOS game Scorched Earth
"The Mother Of All Games".  Scorched 3D adds amongst other new
features a 3D island environment and LAN and internet play.  At its
lowest level, Scorched 3D is just an artillery game with two+ tanks
taking turns to destroy opponents in an arena.  Choose the angle,
direction and power of each shot, launch your weapon, and try to blow
up other tanks.  But Scorched 3D can be a lot more complex than that,
if you want it to be.  You can earn money from successful battles and
use it to invest in additional weapons and accessories.  You can play
with up to twenty four other players at a time, mixing computer
players with humans.  There's a variety of changing environmental
conditions and terrains to be dealt with.



%prep
%if %{defined gitref}
%setup -q -n %{name}-%{gitref}
%else
%setup -q
%endif

%if 0%{without mesonbuildsys}

# Generate Makefile.am files first !!!
cd scripts
perl createAMMakefile.pl
cd ..

%endif



%build
%set_build_flags

# GCC versions
export CC='%{multi_gcc}'
export CPP='%{multi_gpp}'
export CXX='%{multi_gxx}'

%if 0%{with mesonbuildsys}

%meson \
	--datadir=%{_datadir}/%{name} \
	-Ddocdir=%{_defaultdocdir}/%{name}

%meson_build

%else

autoreconf -fiv

# BUG with Autoconf 2.69
sed -i -e '/^\.$/d' configure

%configure \
%if 0%{?mageia} || 0%{?fedora} || 0%{?alma_linux} || 0%{?rhel_version} || 0%{?centos_version}
	--with-system-lua=lua-%{use_lua_ver} \
%else
	--with-system-lua=lua%{use_lua_ver} \
%endif
	--datadir=%{_datadir}/%{name} \
	--with-docdir=%{_defaultdocdir}/%{name}

%make_build

%endif



%install
%if 0%{with mesonbuildsys}

%meson_install

%else

%make_install

%endif

# TODO Move some of these to licenses
# rm -r "%%{buildroot}%%{_defaultdocdir}/%%{name}"

# Install .desktop file and icon
install -D -m 0644 "%{SOURCE1}"          "%{buildroot}%{_datadir}/applications/%{name}.desktop"
install -D -m 0644 data/images/tank2.png "%{buildroot}%{_datadir}/pixmaps/%{name}.png"

# Fix file duplicates
%fdupes %{buildroot}%{_datadir}/%{name}



%files
%license COPYING
%doc     README.md .images/ CHANGELOG

%{_bindir}/%{name}*
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_defaultdocdir}/%{name}/



%changelog

* Mon Jul 14 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by