9d4c239
%global pkgversion %(echo %version|sed s/\\\\\.//g) 
9d4c239
9d4c239
Name:           whichwayisup
9d4c239
Version:        0.7.9
9d4c239
Release:        3%{?dist}
9d4c239
Summary:        2D platform game with a slight rotational twist
9d4c239
9d4c239
# All game content, sounds and graphics are licensed under
9d4c239
# Creative Commons 3.0 Attribution license.
9d4c239
License:        GPLv2 and CC-BY
9d4c239
URL:            http://www.oletus.fi/static/whichwayisup/
9d4c239
Source0:        http://www.oletus.fi/static/whichwayisup/%{name}_b%{pkgversion}.zip
9d4c239
# Desktop file taken from Debian
9d4c239
Source1:        %{name}.desktop
9d4c239
# AppData file provided by Iwicki Artur
9d4c239
Source2:        %{name}.appdata.xml
9d4c239
# Man page taken from Debian
9d4c239
Source3:        %{name}.6
9d4c239
# Under certain circumstances whichwayisup detected keyboards as joysticks
9d4c239
# http://bugs.debian.org/710162
9d4c239
Patch0:         %{name}-0.7.9-check_for_joystick_axes_not_null.patch
9d4c239
# Initialize only required pygame modules
9d4c239
# http://bugs.debian.org/432015
9d4c239
Patch1:         %{name}-0.7.9-initialize_only_required_pygame_modules.patch
9d4c239
9d4c239
BuildArch:      noarch
9d4c239
9d4c239
BuildRequires:  ImageMagick
9d4c239
BuildRequires:  desktop-file-utils
9d4c239
BuildRequires:  libappstream-glib
9d4c239
Requires:       pygame
9d4c239
Requires:       bitstream-vera-sans-fonts
9d4c239
Requires:       hicolor-icon-theme
9d4c239
9d4c239
%description
9d4c239
A traditional and challenging 2D platform game with a slight rotational 
9d4c239
twist. Help a mysterious big-eared salaryman named Guy find his keys in a 
9d4c239
labyrinth of dangers and bad dialogue.
9d4c239
9d4c239
%prep
9d4c239
%autosetup -n %{name} -p1
9d4c239
9d4c239
# Fix script interpreter
9d4c239
sed -i 's!/usr/bin/env python!/usr/bin/python2!' run_game.py
9d4c239
9d4c239
# Change data path
9d4c239
sed -i "s!libdir = .*!libdir = '%{_datadir}/%{name}/lib'!" run_game.py
9d4c239
9d4c239
# Fix end-of-line encoding
9d4c239
sed -i 's/\r//' changelog.txt
9d4c239
9d4c239
# Remove Thumbs.db
9d4c239
rm data/pictures/Thumbs.db
9d4c239
9d4c239
9d4c239
%build
9d4c239
# Empty
9d4c239
9d4c239
9d4c239
%install
9d4c239
# Install launcher script
9d4c239
install -d %{buildroot}%{_bindir}
9d4c239
install -m 755 -p run_game.py %{buildroot}%{_bindir}/%{name}
9d4c239
9d4c239
# Install game and data
9d4c239
install -d %{buildroot}%{_datadir}/%{name}
9d4c239
cp -pr data lib %{buildroot}%{_datadir}/%{name}
9d4c239
9d4c239
# Install icons
9d4c239
for i in 0 1 2 ; do
9d4c239
  px=$(expr 64 - ${i} \* 16)
9d4c239
  mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${px}x${px}/apps
9d4c239
  convert lib/whichway.ico[${i}] \
9d4c239
    %{buildroot}%{_datadir}/icons/hicolor/${px}x${px}/apps/%{name}.png
9d4c239
done
9d4c239
9d4c239
# Install desktop file
9d4c239
desktop-file-install \
9d4c239
  --dir %{buildroot}%{_datadir}/applications \
9d4c239
  %{SOURCE1}
9d4c239
9d4c239
# Install AppData file
9d4c239
install -d %{buildroot}%{_datadir}/appdata
9d4c239
install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/appdata
9d4c239
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml
9d4c239
9d4c239
# Install man page
9d4c239
install -d %{buildroot}%{_mandir}/man6
9d4c239
install -p -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man6/
9d4c239
9d4c239
# Symlink system font
9d4c239
rm %{buildroot}%{_datadir}/%{name}/data/misc/Vera.ttf
9d4c239
ln -s %{_datadir}/fonts/bitstream-vera/Vera.ttf \
9d4c239
    %{buildroot}%{_datadir}/%{name}/data/misc/Vera.ttf
9d4c239
9d4c239
9d4c239
%post
9d4c239
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
9d4c239
9d4c239
9d4c239
%postun
9d4c239
if [ $1 -eq 0 ] ; then
9d4c239
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
9d4c239
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
9d4c239
fi
9d4c239
9d4c239
9d4c239
%posttrans
9d4c239
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
9d4c239
9d4c239
9d4c239
%files
9d4c239
%doc README.txt changelog.txt
9d4c239
%{_bindir}/%{name}
9d4c239
%{_datadir}/%{name}
9d4c239
%{_datadir}/appdata/%{name}.appdata.xml
9d4c239
%{_datadir}/applications/%{name}.desktop
9d4c239
%{_datadir}/icons/hicolor/*/apps/%{name}.png
9d4c239
%{_mandir}/man6/%{name}.6*
9d4c239
9d4c239
9d4c239
%changelog
9d4c239
* Sat Jul 08 2017 Andrea Musuruane <musuruan@gmail.com> - 0.7.9-3
9d4c239
- Added missing BR
9d4c239
9d4c239
* Mon Jun 26 2017 Andrea Musuruane <musuruan@gmail.com> - 0.7.9-2
9d4c239
- Removed wrapper script and changed data path in launcher script
9d4c239
- Added a patch from Debian to initialize only required pygame modules
9d4c239
- Added AppData file
9d4c239
- Removed Thumbs.db file (Windows Explorer thumbnail database)
9d4c239
- Fixed macro style
9d4c239
- Minor fixes
9d4c239
9d4c239
* Sun Jun 25 2017 Andrea Musuruane <musuruan@gmail.com> - 0.7.9-1
9d4c239
- First release
9d4c239