Blob Blame History Raw
%global pkgversion %(echo %version|sed s/\\\\\.//g) 

Name:           whichwayisup
Version:        0.7.9
Release:        3%{?dist}
Summary:        2D platform game with a slight rotational twist

# All game content, sounds and graphics are licensed under
# Creative Commons 3.0 Attribution license.
License:        GPLv2 and CC-BY
# Desktop file taken from Debian
Source1:        %{name}.desktop
# AppData file provided by Iwicki Artur
Source2:        %{name}.appdata.xml
# Man page taken from Debian
Source3:        %{name}.6
# Under certain circumstances whichwayisup detected keyboards as joysticks
Patch0:         %{name}-0.7.9-check_for_joystick_axes_not_null.patch
# Initialize only required pygame modules
Patch1:         %{name}-0.7.9-initialize_only_required_pygame_modules.patch

BuildArch:      noarch

BuildRequires:  ImageMagick
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
Requires:       pygame
Requires:       bitstream-vera-sans-fonts
Requires:       hicolor-icon-theme

A traditional and challenging 2D platform game with a slight rotational 
twist. Help a mysterious big-eared salaryman named Guy find his keys in a 
labyrinth of dangers and bad dialogue.

%autosetup -n %{name} -p1

# Fix script interpreter
sed -i 's!/usr/bin/env python!/usr/bin/python2!'

# Change data path
sed -i "s!libdir = .*!libdir = '%{_datadir}/%{name}/lib'!"

# Fix end-of-line encoding
sed -i 's/\r//' changelog.txt

# Remove Thumbs.db
rm data/pictures/Thumbs.db

# Empty

# Install launcher script
install -d %{buildroot}%{_bindir}
install -m 755 -p %{buildroot}%{_bindir}/%{name}

# Install game and data
install -d %{buildroot}%{_datadir}/%{name}
cp -pr data lib %{buildroot}%{_datadir}/%{name}

# Install icons
for i in 0 1 2 ; do
  px=$(expr 64 - ${i} \* 16)
  mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${px}x${px}/apps
  convert lib/whichway.ico[${i}] \

# Install desktop file
desktop-file-install \
  --dir %{buildroot}%{_datadir}/applications \

# Install AppData file
install -d %{buildroot}%{_datadir}/appdata
install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/appdata
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml

# Install man page
install -d %{buildroot}%{_mandir}/man6
install -p -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man6/

# Symlink system font
rm %{buildroot}%{_datadir}/%{name}/data/misc/Vera.ttf
ln -s %{_datadir}/fonts/bitstream-vera/Vera.ttf \

touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%doc README.txt changelog.txt

* Sat Jul 08 2017 Andrea Musuruane <> - 0.7.9-3
- Added missing BR

* Mon Jun 26 2017 Andrea Musuruane <> - 0.7.9-2
- Removed wrapper script and changed data path in launcher script
- Added a patch from Debian to initialize only required pygame modules
- Added AppData file
- Removed Thumbs.db file (Windows Explorer thumbnail database)
- Fixed macro style
- Minor fixes

* Sun Jun 25 2017 Andrea Musuruane <> - 0.7.9-1
- First release