File rtcw.spec of Package rtcw

#
# spec file for package rtcw
#
# Copyright (c) 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:           rtcw
Version:        0~git20231210
Release:        0
Summary:        Game engine for Return to Castle Wolfenstein
#src/lib/dear_imgui/* is licensed under MIT
#src/lib/glm/* is licensed under MIT
#src/lib/miniz/* is licensed under MIT
License:        GPL-3.0-only
Group:          Amusements/Games/3D/Shoot
URL:            https://github.com/bibendovsky/rtcw
#Git-Clone:     https://github.com/bibendovsky/rtcw.git
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(SDL2_net)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(sdl2)
Provides:       bundled(imgui)
Provides:       bundled(glm)
Provides:       bundled(miniz)

%description
RTCW: One source port for all Return to Castle Wolfenstein games
(singleplayer, multi-player, Enemy Territory).

%prep
%setup -q
sed -i 's/\r$//' README.md

# HACK: introduce RTCW_DESTDIR to cmake
find . -name "CMakeLists.txt" |xargs sed -i 's|DESTINATION |DESTINATION ${RTCW_DESTDIR}/|g'

%build
%cmake \
  -DRTCW_DESTDIR="%{_libexecdir}/rtcw/" \
  -DRTCW_ET=ON \
  -DRTCW_ET_DED=ON \
  -DRTCW_MP=ON \
  -DRTCW_MP_DED=ON \
  -DRTCW_SP=ON
%cmake_build

%install
%cmake_install
install -d %{buildroot}%{_bindir}
## ET
echo -e "#!/bin/sh\nexec %{_libexecdir}/rtcw/et/rtcw_et_x64 \"\$@\"" > %{buildroot}%{_bindir}/rtcw_et
chmod 755 %{buildroot}%{_bindir}/rtcw_et
## ET - dedicated server
echo -e "#!/bin/sh\nexec %{_libexecdir}/rtcw/et/rtcw_et_ded_x64 \"\$@\"" > %{buildroot}%{_bindir}/rtcw_et_ded
chmod 755 %{buildroot}%{_bindir}/rtcw_et_ded

## MP
echo -e "#!/bin/sh\nexec %{_libexecdir}/rtcw/sp-mp/rtcw_mp_x64 \"\$@\"" > %{buildroot}%{_bindir}/rtcw_mp
chmod 755 %{buildroot}%{_bindir}/rtcw_mp
## MP - dedicated server
echo -e "#!/bin/sh\nexec %{_libexecdir}/rtcw/sp-mp/rtcw_mp_ded_x64 \"\$@\"" > %{buildroot}%{_bindir}/rtcw_mp_ded
chmod 755 %{buildroot}%{_bindir}/rtcw_mp_ded

## SP
echo -e "#!/bin/sh\nexec %{_libexecdir}/rtcw/sp-mp/rtcw_sp_x64 \"\$@\"" > %{buildroot}%{_bindir}/rtcw_sp
chmod 755 %{buildroot}%{_bindir}/rtcw_sp


for i in et mp sp; do
  mv doc/original/$i/COPYING.txt COPYING.$i.txt
  mv doc/original/$i/README.txt README.$i.txt
done

%files
%license COPYING.*.txt
%doc README.md
%doc README.*.txt
%{_libexecdir}/rtcw
## ET
%{_bindir}/rtcw_et
%{_bindir}/rtcw_et_ded
## MP
%{_bindir}/rtcw_mp
%{_bindir}/rtcw_mp_ded
## SP
%{_bindir}/rtcw_sp

%changelog
openSUSE Build Service is sponsored by