File OpenJK.spec of Package OpenJK

#
# spec file for package OpenJK
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           OpenJK
Version:        git
Release:        0
Summary:        Open Source Jedi Knight engine
License:        GPL-2.0
Group:          Amusements/Games/Other
Url:            https://github.com/JACoders/OpenJK
Source:         %{name}-%{version}.tar.xz
Source1:        openjkmp.desktop
Source2:        openjkmp.png
Source3:        openjksp.desktop
Source4:        openjksp.png
Source99:       %{name}.changes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libjpeg8-devel
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)

%ifarch x86_64
%define openjk_arch x86_64
%else
%define openjk_arch i386
%endif

%description
OpenJK is an effort by the JACoders group to maintain and improve the game engines on which the
Jedi Academy (JA) and Jedi Outcast (JO) games run on, while maintaining full backwards compatibility
with the existing games. This project does not attempt to rebalance or otherwise modify core gameplay.

You need to copy GameData/base/*.{pk3,cfg} from either your installation media or your hard drive to
~/.local/share/openjk/base before running the game.

%prep
%setup -q

%build
%cmake -DCMAKE_INSTALL_PREFIX=%{_libexecdir}/openjk

make %{?_smp_mflags}

%install
%cmake_install

install -d %{buildroot}%{_bindir}

for openjk_bin in openjk openjk_sp openjkded; do
  cat >> %{buildroot}%{_bindir}/${openjk_bin} <<EOF
#!/bin/sh
cd %{_libexecdir}/openjk/JediAcademy
exec ./${openjk_bin}.%{openjk_arch} "\$@"
EOF
  chmod +x %{buildroot}%{_bindir}/${openjk_bin}
done

install -Dm644 %{S:1} %{buildroot}%{_datadir}/applications/openjkmp.desktop
install -Dm644 %{S:2} %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/openjkmp.png
install -Dm644 %{S:3} %{buildroot}%{_datadir}/applications/openjksp.desktop
install -Dm644 %{S:4} %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/openjksp.png

%fdupes %{buildroot}%{_prefix}

%post
%icon_theme_cache_post
%desktop_database_post

%postun
%icon_theme_cache_postun
%desktop_database_postun

%files
%defattr(-,root,root,0755)
%{_bindir}/openjk
%{_bindir}/openjk_sp
%{_bindir}/openjkded
%defattr(-,root,root)
%{_libexecdir}/openjk
%{_datadir}/applications/openjk*.desktop
%{_datadir}/icons/hicolor/256x256/apps/openjk*.png

%changelog