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

Name:           OpenJK
Version:        git
Release:        0
Summary:        Open Source Jedi Knight engine
License:        GPL-2.0
Group:          Amusements/Games/Other
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
%define openjk_arch i386

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.

%setup -q

%cmake -DCMAKE_INSTALL_PREFIX=%{_libexecdir}/openjk

make %{?_smp_mflags}


install -d %{buildroot}%{_bindir}

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

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}