%define name syasokoban
%define version 2.0.1
%define release 1%{?_dist_release}

Summary: Sokoban puzzle game
Summary(ja): 倉庫番パズルゲーム
Name: %{name}
Version: %{version}
Release: %{release}
#Source0: http://scorpioncity.com/sokoban/%{name}Src.zip # ver.2.0 
Source0: %{name}-%{version}.tar.gz
License: BSD License
Group: Applications/Games
URL: http://scorpioncity.com/sokoban.html

Requires: SDL
BuildRequires: SDL-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root


%description
An implementation of the popular Sokoban puzzle game. 
The goal is to push the crates onto the designated squares 
without getting stuck.

#%desctiption -l ja


%prep
rm -rf ${RPM_BUILD_ROOT}

%setup -q 

%build
make

%install
#make DESTDIR=${RPM_BUILD_ROOT} install
mkdir -p  ${RPM_BUILD_ROOT}/usr/share/SYASokoban
cp README.txt syasokoban ${RPM_BUILD_ROOT}/usr/share/SYASokoban/
cp -r data ${RPM_BUILD_ROOT}/usr/share/SYASokoban/
mkdir -p ${RPM_BUILD_ROOT}/usr/share/applications
cat >  ${RPM_BUILD_ROOT}/usr/share/applications/%{name}.desktop <<EOF
[Desktop Entry]
Name=Still Yet Another Sokoban
Comment=An implementation of the popular Sokoban puzzle game.
TryExec=syasokoban
Exec=/usr/bin/syasokoban
Icon=
Terminal=0
Type=Application
Categories=GNOME;Application;Game
EOF

# syasokobanの実行スクリプトを作成：ソースを書き換える？？？
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
cat > ${RPM_BUILD_ROOT}/usr/bin/syasokoban <<EOF
#! /bin/bash
cd /usr/share/SYASokoban/; ./syasokoban
EOF

# syasokobanが実行したときのログファイルが同じディレクトリにできるので、
# それが書き込めるようにした対処策：ソースを書き換える？？？
cat > ${RPM_BUILD_ROOT}/usr/share/SYASokoban/syasokobanlog.txt <<EOF
Sokoban:OnMouseEnter (0 0)
Desktop:OnMouseEnter (0 0)
CSokoban::Destroy()
EOF


%clean
rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
/usr/share/SYASokoban
%attr(755,root,root) /usr/bin/syasokoban
%attr(770,root,root) /usr/share/SYASokoban/syasokobanlog.txt
/usr/share/applications/%{name}.desktop

%changelog
* Sat Oct 11 2008 Shu KONNO <owa@bg.wakwak.com> 2.0.1-1vl5
- new upstream release
- applied new versioning policy, spec in utf-8

* Sun Jun 3 2007 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 2.0-0vl2
- rebuild for VineSeed

* Tue Mar 9 2007 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 2.0-0vl1
- initial build for Vine Linux

# * Sun Jul 2 2006 2.0-0vl1
# - Update

# * Mon Jul 4 2005 1.02-0vl1
# - initial build for Vine Linux

# end of file
