File assaultcube-reloaded.spec of Package assaultcube-reloaded

#
# spec file for package assaultcube-reloaded
#
# Copyright (c) 2025 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/
#


%if 0%{?suse_version} >= 1600
%bcond_with docs
%else
%bcond_without docs
%endif
Name:           assaultcube-reloaded
Version:        2.18.3
Release:        0
Summary:        Free first-person-shooter based on the game Cube
License:        Zlib
Group:          Amusements/Games/Action/Shoot
URL:            https://acr.victorz.ca/
Source0:        https://github.com/acreloaded/acr/archive/refs/tags/v%{version}.tar.gz#/acr-%{version}.tar.gz
Source1:        assaultcube-reloaded.png
Source2:        acreloaded.sh
Source3:        acreloaded-server.sh
# PATCH-FIX-UPSTREAM https://github.com/acreloaded/acr/pull/12 See also https://github.com/acreloaded/acr/pull/201
Patch0:         Makefile.patch
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL_image)
BuildRequires:  pkgconfig(SDL_mixer)
BuildRequires:  pkgconfig(dri)
BuildRequires:  pkgconfig(freealut)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(zlib)
Requires:       %{name}-data >= %{version}

%description
AssaultCube Reloaded is a free-and-open-source first-person-shooter
aimed at improving its predecessor, AssaultCube. This game combines
the best of all worlds. Realism from Battlefield, anti-cheat from
the Quake engine, perks from Call of Duty, and fast-paced game play
with a low system footprint from AssaultCube.

%package data
Summary:        AssaultCube Reloaded data files
License:        SUSE-CC-Sampling-Plus-1.0 AND CC-BY-SA-2.0 AND CC-BY-3.0 AND CC-BY-SA-3.0 AND LGPL-2.1-only AND CC-BY-NC-SA-2.5 AND CC-BY-NC-3.0 AND CC-BY-NC-SA-3.0
Group:          Amusements/Games/Action/Shoot
BuildArch:      noarch

%description data
This package contains the data files for AssautCube Reloaded.

%if %{with docs}
%package doc
Summary:        AssaultCube Reloaded documentation
License:        SUSE-CC-Sampling-Plus-1.0 AND CC-BY-SA-2.0 AND CC-BY-3.0 AND CC-BY-SA-3.0 AND LGPL-2.1-only AND CC-BY-NC-SA-2.5 AND CC-BY-NC-3.0 AND CC-BY-NC-SA-3.0
Group:          Amusements/Games/Action/Shoot
BuildArch:      noarch

%description doc
This package contains the documentation files for AssautCube Reloaded.
%endif

%prep
%setup -q -n acr-%{version}
%patch -P 0 -p1

rm bin_win32/*

# fix line endings recursively
cd source
chmod 644 README*
dos2unix README*
cd ..
cd docs
find . -type f -exec dos2unix {} +

%build
pushd source/src
%make_build CXXOPTFLAGS="%{optflags}" client server
popd

%install
pushd source/src
%make_install
popd

# assets
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -rf bot config packages acr/packages %{buildroot}%{_datadir}/%{name}
chmod +x %{buildroot}%{_datadir}/%{name}/config/convert_mapconfig.sh

# executables
mkdir -p %{buildroot}%{_libexecdir}/%{name}
install -Dm755 bin_unix/native_client %{buildroot}%{_libexecdir}/%{name}/native_client
install -Dm755 bin_unix/native_server %{buildroot}%{_libexecdir}/%{name}/native_server

# launch scripts
install -D -m 755 %{SOURCE2} %{buildroot}%{_bindir}/%{name}-client
install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/%{name}-server

# icon
install -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/%{name}.png

# menu-entry
%suse_update_desktop_file -c assaultcube-reloaded "AssaultCube Reloaded" "First Person Shooter" assaultcube-reloaded-client assaultcube-reloaded Game ActionGame
%fdupes %{buildroot}%{_datadir}

%find_lang AC

%files
%{_bindir}/%{name}-client
%{_bindir}/%{name}-server
%{_libexecdir}/%{name}
%{_datadir}/applications/assaultcube-reloaded.desktop
%{_datadir}/pixmaps/assaultcube-reloaded.png

%files data -f AC.lang
%{_datadir}/%{name}/

%if %{with docs}
%files doc
%doc source/*.txt
%doc docs
%endif

%changelog
openSUSE Build Service is sponsored by