File njam.spec of Package njam
#
# spec file for package njam
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Malcolm Lewis malcolmlewis@opensuse.org
#
# 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: njam
Version: 1.25
Release: 0
Summary: Pacman like game
License: GPL-2.0+
Group: Amusements/Games/Action/Arcade
Url: http://njam.sourceforge.net/
Source0: %{name}-%{version}-src.tar.bz2
# Source from fc15 src rpm as download from sourceforge corrupt!!!!
#Source0: http://cdnetworks-us-1.dl.sourceforge.net/project/njam/njam/njam-1.25/njam-1.25-src.tar.gz
Source1: %{name}.6
# PATCH-FIX-OPENSUSE njam-drop-setgid.patch malcolmlewis@opensuse.org -- Fix Fedora setgid patch
Patch0: njam-drop-setgid.patch
# PATCH-FIX-OPENSUSE njam-1.25-html.patch j.w.r.degoede@hhs.nl -- Fix broken home link in doc-editor.html
Patch1: njam-1.25-html.patch
# PATCH-FIX-OPENSUSE njam-1.25-leveledit.patch j.w.r.degoede@hhs.nl -- Fixes the leveleditor to save custom made levels under $HOME/.njam-levels
Patch2: njam-1.25-leveledit.patch
# PATCH-FIX-OPENSUSE njam-1.25-gcc45.patch hdegoede@redhat.com -- Fix compilation with gcc 4.5
Patch3: njam-1.25-gcc45.patch
BuildRequires: ImageMagick
BuildRequires: SDL-devel
BuildRequires: SDL_image-devel
BuildRequires: SDL_mixer-devel
BuildRequires: SDL_net-devel
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: update-desktop-files
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1320
Requires(post): user(games)
%endif
%description
Njam is a full-featured cross-platform pac-man like game written in C++
using SDL library Features
%prep
%setup -q -n %{name}-%{version}-src
%patch0
%patch1 -p1
%patch2 -p1 -z .leveledit
%patch3 -p1
%build
%configure
make %{?_smp_mflags}
%install
%makeinstall
# make install installs the docs under /usr/share/njam. We want them in %%doc.
rm %{buildroot}%{_datadir}/%{name}/README
rm %{buildroot}%{_datadir}/%{name}/levels/readme.txt
rm -fr %{buildroot}%{_datadir}/%{name}/html
# clean up cruft
rm %{buildroot}%{_datadir}/%{name}/%{name}.*
rm %{buildroot}%{_datadir}/%{name}/njamicon.ico
# we want the hiscore in /var/games
mkdir -p %{buildroot}%{_localstatedir}/games/
mv %{buildroot}%{_datadir}/%{name}/hiscore.dat \
%{buildroot}%{_localstatedir}/games/%{name}.hs
# add the manpage (courtesy of Debian)
mkdir -p %{buildroot}%{_mandir}/man6
install -m 0644 %{S:1} %{buildroot}%{_mandir}/man6
# Fix icon size, install and create desktop file
convert -strip -resize 48x48 njamicon.ico njam.png
mkdir -p %{buildroot}%{_datadir}/pixmaps
install -c -m 0644 njam.png %{buildroot}%{_datadir}/pixmaps
%suse_update_desktop_file -c %{name} %{name} "Pacman like game" /usr/bin/%{name} %{name} Game ArcadeGame
%fdupes -s %{buildroot}
%files
%defattr(-,root,root)
%doc ChangeLog COPYING NEWS README TODO levels/readme.txt html
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/%{name}
%{_mandir}/man6/%{name}.6.gz
%defattr(0755,games,games)
%verify(not mode) %{_bindir}/%{name}
%defattr(0775,games,users)
%config(noreplace) %attr (0664,games,users) %{_localstatedir}/games/%{name}.hs
%changelog