%define name	tuxtype2
%define version	1.8.1
%define release	2%{?_dist_release}

Summary:	An educational typing tutor for children
Summary(ja):	子供向けのタイピング練習ゲーム

Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	tuxtype_w_fonts-%{version}.tar.gz
Source1:	tuxtype2.desktop
Patch0:         tuxtype2-1.8.1-chown.patch
License:	GPLv2+
Group:		Applications/Games
URL:		http://tuxtype.sourceforge.net/

Requires:	SDL >= 1.2.5, SDL_image >= 1.2.3
Requires:	SDL_mixer >= 1.2.5, SDL_ttf >= 2.0.5
BuildRequires:	SDL-devel >= 1.2.5, SDL_image-devel >= 1.2.3
BuildRequires:	SDL_mixer-devel >= 1.2.5, SDL_ttf-devel >= 2.0.5
BuildRequires:	SDL_Pango-devel
BuildRequires:	librsvg2-devel
BuildRequires:	ImageMagick

BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Conflicts:	tuxtype < 1.0.2


%description
"Tux Typing" is an educational typing tutor for children. It features
several different types of gameplay, at a variety of difficulty levels.

%description -l ja
Tux Typing は，子供向けのタイピング練習ゲームです。数種類の異なるゲームが
含まれていて、難易度も自由に選ぶことができます。


%prep
%setup -q -n tuxtype_w_fonts-%{version}
%patch0 -p1 -b .chown

rm -rf data/fonts/*.ttf
# fix wrong end of line encoding
sed -i -e 's|\r||g' doc/en/TuxType_port_Mac.txt
#unknow lang
pushd po
mv zh_N.gmo zh_CN.gmo
mv zh_N.po zh_CN.po
popd

# fix gettext version
sed -i "s|0.17|0.18|g" configure.ac
sed -i "s|0.17|0.18|g" aclocal.m4

%build
autoreconf -if
%configure --localstatedir=%{_localstatedir}/games 
make %{?_smp_mflags}


%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=$RPM_BUILD_ROOT

rm -rf $RPM_BUILD_ROOT%{_datadir}/doc

# install menu entry.
install -d $RPM_BUILD_ROOT%{_datadir}/applications
install -p -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/applications/

install -d $RPM_BUILD_ROOT%{_datadir}/pixmaps/
convert -size 48x48 tuxtype.ico $RPM_BUILD_ROOT%{_datadir}/pixmaps/tuxtype.png

install -d $RPM_BUILD_ROOT%{_localstatedir}/games/tuxtype

%find_lang tuxtype

%clean
rm -rf ${RPM_BUILD_ROOT}


%files -f tuxtype.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README TODO doc/en/howtotheme.html doc/en/TuxType_port_Mac.txt
%attr(-,root,games) %{_bindir}/tuxtype
%{_datadir}/pixmaps/*
%{_datadir}/applications/*
%{_datadir}/tuxtype
%config(noreplace) %{_sysconfdir}/tuxtype
%attr(0755,root,games) %config(noreplace) %{_localstatedir}/games/tuxtype


%changelog
* Sun Dec 07 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.1-2
- rebuild with libpng-1.6.12

* Sun Jul 10 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.1-1
- update to 1.8.1
- add BuildRequires: SDL_Pango-devel, librsvg2-devel, ImageMagick
- merge spec file from fedora packages

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

* Sat May 07 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.5.3-0vl1
- initial build for VineSeed Plus.
