File falconseye.spec of Package falconseye

#
# spec file for package falconseye
#
# Copyright (c) 2016 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:           falconseye
####License:        Other License(s), see package 
#### it's the Nethack General Public License ngpl, see http://spdx.org/licenses/NGPL
Requires:       timidity
PreReq:         fileutils permissions
Version:        1.9.3
Release:        0
Source:         %{name}-%{version}.tar.bz2
Source1:        %name.desktop
Source99:       %{name}.changes
Patch:          %{name}-%{version}.diff
Patch1:         %{name}-libs.patch
Patch2:         %{name}-tinfo.patch
Url:            http://www.hut.fi/~jtpelto2/nethack.html
Summary:        A Mouse-Driven interface for NetHack
License:        NGPL
Group:          Amusements/Games/RPG
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  SDL-devel
BuildRequires:  alsa-devel
BuildRequires:  bison
BuildRequires:  cpp
BuildRequires:  flex
BuildRequires:  gdbm-devel
BuildRequires:  glib2-devel
BuildRequires:  glibc-devel
BuildRequires:  libtool
BuildRequires:  ncurses-devel
BuildRequires:  permissions
BuildRequires:  slang-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
BuildRequires:  zlib-devel

%description
Falcon's Eye is a mouse-driven interface for NetHack that enhances the
visuals, audio, and accessibility of the game, yet retains all the
original gameplay and game features.

Falcon's Eye needs to be installed together with nh_data and is run as
nethack.



%prep
%setup -q
%patch
%patch1
#from 12.1 is ncurses splitted
%if 0%{?suse_version} > 1210
%patch2
%endif
# fix build-compare
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE99}")"
EPOCH=$(date -d "${modified}" "+%%s")
sed -i "s/(void) time((time_t \\*)&clocktim)/clocktim=$EPOCH/" util/makedefs.c

%build
sh sys/unix/setup.sh links
# parallel build fails
make -C src CC="gcc $RPM_OPT_FLAGS" -j1

%install
make DESTDIR="$RPM_BUILD_ROOT" install
mv $RPM_BUILD_ROOT/usr/share/games/falconseye/falconseye \
  $RPM_BUILD_ROOT/usr/games/falconseye.bin
ln -snf /usr/games/falconseye.bin \
  $RPM_BUILD_ROOT/usr/share/games/falconseye/falconseye
%suse_update_desktop_file -i %name Game X-SuSE-AdventureGame
rmdir $RPM_BUILD_ROOT/usr/share/games/falconseye/save
mkdir -p $RPM_BUILD_ROOT/var/games/falconseye/save
ln -s /var/games/falconseye/save $RPM_BUILD_ROOT/usr/share/games/falconseye/save
touch $RPM_BUILD_ROOT/var/games/falconseye/jtp_log.txt
ln -s /var/games/falconseye/jtp_log.txt $RPM_BUILD_ROOT/usr/share/games/falconseye/jtp_log.txt

%pre
# Move save files from old location.
mkdir -p var/games/falconseye/save
mv usr/share/games/falconseye/save/* var/games/falconseye/save >/dev/null 2>/dev/null || true
rmdir usr/share/games/falconseye/save >/dev/null 2>/dev/null || true

%post
%if 0%{?suse_version} < 1140
%run_permissions
%else
%set_permissions /usr/games/falconseye.bin
%endif

%verifyscript
%verify_permissions -e /usr/games/falconseye.bin

%files
%defattr(-,root,root)
%attr(0775,games,games) %dir /usr/share/games/falconseye
/usr/share/games/falconseye/*
/usr/games/falconseye
%verify(not mode) %attr(0755,games,games) /usr/games/falconseye.bin
/usr/share/applications/%name.desktop
%attr(0775,games,games) %dir /var/games/falconseye
%attr(0775,games,games) %dir /var/games/falconseye/save
%attr(0664,games,games) %verify(not size md5 mtime) /var/games/falconseye/jtp_log.txt

%changelog