%define name tecnoballz
%define version 0.92
%define release 1%{?_dist_release}

Summary: A Breakout like game.
Summary(ja): ブロック崩し
Name: %{name}
Version: %{version}
Release: %{release}
Source0: http://linux.tlk.fr/games/TecnoballZ/download/%{name}-%{version}.tgz
Source1: %{name}.png
Source2: %{name}.desktop
License: GPLv3
Group: Applications/Games
URL: http://linux.tlk.fr/games/TecnoballZ/

Requires: SDL SDL_mixer libogg libvorbis mikmod smpeg
BuildRequires: SDL-devel SDL_mixer-devel
BuildRequires: libogg-devel libvorbis-devel mikmod-devel smpeg-devel sed
BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux
Packager: OOI Keita <ooi.keita@gmail.com>

%description
A exciting Brick Breaker with 50 levels of game and 11 special levels,
distributed on the 2 modes of game to give the player a sophisticated
system of attack weapons with an enormous power of fire that can be
build by gaining bonuses. Numerous decors, musics and sounds
complete this great game. This game was ported from the Commodore Amiga.

%description -l ja
すべてのブロックを壊せば、各面をクリアできます。
ゲームにはいくつかのアリアがあり、エリアは更に面に分かれています。
ボスキャラのいる面もあります。
エリアを通過する毎に、一つずつ、面の端の壁が開きます。
各面の間では、ゲーム中に得たお金で、アイテムを購入することも可能です。

%prep
%setup -q
# FIX: set gamedir and scoredir
sed -i 's|gamesdir = $(prefix)/games|gamesdir = ${bindir}|' src/Makefile.in
sed -i 's|scoredir = /var/games/tecnoballz|scoredir = ${localstatedir}/games/%{name}|' Makefile.in

%build
%configure
make %{?_smp_mflags} CXXFLAGS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=%{buildroot}
cp -fr src/TecnoballZ/levels-data.xml ${RPM_BUILD_ROOT}%{_datadir}/%{name}
cp -fr src/TecnoballZ/texts ${RPM_BUILD_ROOT}%{_datadir}/%{name}

# install icon
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/pixmaps
install -p -m 0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/%{name}.png

# install desktop
sed "s/Icon=tecnoballz.png/Icon=tecnoballz/" %{SOURCE2} > %{name}.desktop
desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{name}.desktop

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :

%postun
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :

%files
%defattr(-,root,root)
%doc AUTHORS CHANGES COPYING INSTALL README
%{_datadir}/%{name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man6/%{name}*
%attr(2755,root,games) %{_bindir}/%{name}
%defattr(-,root,games)
%config(noreplace) %{_localstatedir}/games/%{name}/*

%changelog
* Sun Oct 12 2008 Shu KONNO <owa@bg.wakwak.com> 0.92-1vl5
- applied new versioning policy, spec in utf-8

* Fri Jan 18 2008 Shu KONNO <owa@bg.wakwak.com> 0.92-0vl1
- updated tecnoballz to 0.92
- changed license to GPLv3
- changed description
- dropt %{name}-0.91-owner.patch
- dropt %{name}-0.91-datadir.patch

* Tue Oct  3 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.91-0vl2
- rebuilt for Vine Linux 4.0
- changed Group to Applications/Games

* Sun Mar 13 2005 OOI Keita <ooi.keita@gmail.com> 0.91-0vl1
- initial build
- tecnoballz-0.91-owner-patch
- setup desktop entry and icon
- install man
- tecnoballz-0.91-datadir.patch
