File q-zandronum.spec of Package q-zandronum

#
# spec file for package q-zandronum
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2021-2024, Martin Hauke <mardnh@gmx.de>
#
# 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:           q-zandronum
Version:        1.4.20
Release:        0
Summary:        A DOOM source port focusing on multiplayer
# see: https://zdoom.org/wiki/License
License:        BSD-3-Clause AND Sleepycat
Group:          Amusements/Games/3D/Shoot
URL:            http://qzandronum.com/
#Git-Clone:     https://github.com/IgeNiaI/Q-Zandronum.git
Source:         https://github.com/IgeNiaI/Q-Zandronum/archive/refs/tags/%{version}.tar.gz#/Q-Zandronum-%{version}.tar.gz
Source1:        sqlite.tar.gz
# Icon from https://zandronum.com/tracker/print_bug_page.php?bug_id=3104
Source2:        https://zandronum.com/essentials/fmod/fmodapi42416linux64.tar.gz
Source3:        zandronum_icon.png
Source99:       %{name}-rpmlintrc
BuildRequires:  cmake
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(fluidsynth)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libgme)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(zlib)
%if 0%{?sle_version} >= 150400 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires:  gcc11
BuildRequires:  gcc11-c++
%else
BuildRequires:  gcc-c++
%endif
Provides:       bundled(fmod)
Provides:       bundled(libGeoIP)
Provides:       bundled(libdumb)
Provides:       bundled(libgdtoa)
Provides:       bundled(libgme)
Provides:       bundled(liblzma)
Provides:       bundled(libsqlite3)
ExclusiveArch:  x86_64

%description
Q-Zandronum is a fork of Zandronum 3.0 with improved netcode,
configurable movement and many small tweaks.

Note:
Game data must be placed in ~/.config/zandronum/ .

%prep
%setup -q -n Q-Zandronum-%{version}
tar xzvf %{SOURCE1}
tar xzvf %{SOURCE2}

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

export LANG=C.UTF-8
mkdir build && cd build
cmake .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DSERVERONLY=OFF \
  -DRELEASE_WITH_DEBUG_FILE=OFF \
  -DFMOD_LIBRARY=../fmodapi42416linux64/api/lib/libfmodex64-4.24.16.so \
  -DFMOD_INCLUDE_DIR=../fmodapi42416linux64/api/inc/ \
  -Wno-dev
%make_build

%install
zandronumdir="%{buildroot}%{_libexecdir}/%{name}"
install -d %{buildroot}%{_bindir}
install -d $zandronumdir
install -d $zandronumdir/fmod
install -m 755 build/q-zandronum $zandronumdir/q-zandronum
install -m 755 build/output_sdl/liboutput_sdl.so $zandronumdir/liboutput_sdl.so
install -m 644 build/brightmaps.pk3 $zandronumdir/
install -m 644 build/q-zandronum.pk3 $zandronumdir/
install -m 644 build/skulltag_actors.pk3 $zandronumdir/
install -m 755 fmodapi42416linux64/api/lib/libfmodex64-4.24.16.so $zandronumdir/fmod/

# wrapper
echo -e "#!/bin/sh\nLD_LIBRARY_PATH=\"%{_libexecdir}/%{name}/fmod/\" exec %{_libexecdir}/%{name}/q-zandronum \"\$@\"" > %{buildroot}%{_bindir}/q-zandronum
chmod 755 %{buildroot}%{_bindir}/q-zandronum

# icons
install -Dm 0644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png

# desktop file
%suse_update_desktop_file -c %{name} 'Q-Zandronum' 'Multiplayer DOOM' %{name} %{name} Game ActionGame

%if 0%{?sle_version} >= 150400 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
export NO_BRP_CHECK_RPATH=true
%endif

%files
%license LICENSE.txt
%doc README.md
%{_bindir}/q-zandronum
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/q-zandronum
%{_libexecdir}/%{name}/liboutput_sdl.so
%{_libexecdir}/%{name}/brightmaps.pk3
%{_libexecdir}/%{name}/q-zandronum.pk3
%{_libexecdir}/%{name}/skulltag_actors.pk3
%dir %{_libexecdir}/%{name}/fmod
%{_libexecdir}/%{name}/fmod/libfmodex64-4.24.16.so
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by