File maxr.spec of Package maxr

#
# spec file for package maxr
#
# 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/
#


Name:           maxr
Version:        0.2.17
Release:        0
Summary:        M.A.X.R. (Mechanized Assault and eXploration Reloaded)
License:        CC-BY-SA-3.0 AND GPL-2.0-or-later
Group:          Amusements/Games/Strategy/Turn Based
URL:            https://www.maxr.org/
Source0:        %{name}-release-%{version}.tar.xz
Source1:        https://www.maxr.org/downloads/manual.pdf
Source2:        %{name}.6
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(SDL2_net)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(vorbis)
%if 0%{?sle_version} >= 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires:  gcc11
BuildRequires:  gcc11-c++
%else
BuildRequires:  gcc-c++
%endif

%description
M.A.X.R. (Mechanized Assault and eXploration Reloaded) is a
fanmade strategy game by the community of maxr.org. MAXR is
OpenSource and a remake of the old M.A.X.by Interplay from 1996
featuring network games based on TCP/IP (e.g. over the internet).

The game can be played in a turn-based mode (with or without time
limit), or simultaneous mode (all the players take their turns at
the same time), and features combat in air, land, and sea. Three
resources are present on the maps - Raw Materials, which are
needed to manufacture units, structures and ammunition, Fuel,
which power generators need to function, and Gold, which is
used to purchase upgrades. This game is a mix of realtime and
turnbased strategy with battle chess character.

%prep
%setup -q -n%{name}-release-%{version}

find -name '.empty' -delete -print
dos2unix data/ABOUT data/AUTHORS data/CHANGELOG data/MANUAL
install -m 644 %{SOURCE1} .

%build
%if 0%{?sle_version} >= 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
export CC="gcc-11"
export CXX="g++-11"
%endif

%cmake -DCMAKE_BUILD_TYPE=Release
%make_build

%install
%cmake_install

mkdir -p %{buildroot}%{_libdir}
install -m 755 build/lib*.so %{buildroot}%{_libdir}

# Install icon
install -dm 755 %{buildroot}%{_datadir}/pixmaps
install -m 644 data/%{name}.png %{buildroot}%{_datadir}/pixmaps

# Install menu
install -dm 755 %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=%{name}
Icon=%{name}
Terminal=false
Name=M.A.X.R. (Mechanized Assault and eXploration Reloaded)
GenericName=M.A.X.R. (Mechanized Assault and eXploration Reloaded)
Comment=M.A.X.R. (Mechanized Assault and eXploration Reloaded)
EOF

%suse_update_desktop_file %{name} Game StrategyGame

%fdupes -s %{buildroot}

# Install man page
mkdir -p %{buildroot}%{_mandir}/man6
cp %{SOURCE2} %{buildroot}%{_mandir}/man6

# Use %%doc macro for this
cd %{buildroot}/%{_datadir}/%{name}
rm ABOUT AUTHORS CHANGELOG COPYING* MANUAL

# Not needed
rm languages/update_translations.sh

%files
%doc README.md manual.pdf data/ABOUT data/AUTHORS data/CHANGELOG data/MANUAL
%license data/COPYING*
%{_bindir}/%{name}
%{_mandir}/man?/%{name}.6%{?ext_man}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_libdir}/lib*.so

%changelog
openSUSE Build Service is sponsored by