%define alias_ttf /usr/share/fonts/TrueType-vlgothic/VL-PGothic-Regular.ttf

%define name lincity-ng
%define version 2.0
%define release 5%{?_dist_release}
Summary: City Simulation Game
Summary(ja): 都市シミュレーションゲーム
Name: %{name}
Version: %{version}
Release: %{release}
Source: http://download.berlios.de/%{name}/%{name}-%{version}.tar.bz2
License: GNU General Public License
Group: Applications/Games
URL: http://lincity-ng.berlios.de/

Requires: TrueType-vlgothic
Requires: SDL, SDL_image, SDL_mixer, SDL_ttf, SDL_gfx, 
Requires: zlib, libxml2, physfs
BuildRequires: SDL-devel, SDL_image-devel, SDL_mixer-devel, 
BuildRequires: SDL_ttf-devel, SDL_gfx-devel, 
BuildRequires: mesa-libGL-devel, mesa-libGLU-devel
BuildRequires: zlib-devel, libxml2-devel, physfs-devel, 
BuildRequires: jam, vorbis-tools
BuildRequires: desktop-file-utils
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%description
LinCity-NG is a City Simulation Game. It is a polished and improved
version of the old LinCity game. Within the scope of the GoTM
project at happypenguin.org we create a new iso-3d graphics engine
together with completely redone modern gui.

%description
LinCity-NG は都市シミュレーションゲームです。
以前の LinCity を精錬し、改善されたバージョンです。


%prep
%setup -q
sed -i "s/CFLAGS += -O3 -g -Wall/CFLAGS += $RPM_OPT_FLAGS/" Jamrules
sed -i "s/CXXFLAGS += -O3 -g -Wall/CXXFLAGS += $RPM_OPT_FLAGS/" Jamrules

%build
#./autogen.sh
# export CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \
#     CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector"
%configure
jam

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
jam -s DESTDIR=${RPM_BUILD_ROOT} install

### to convert the sounds
for i in ${RPM_BUILD_ROOT}%{_datadir}/%{name}/sounds/*.wav; do
    oggenc --quiet $i && rm $i
done

# font alias
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/fonts
ln -s %alias_ttf sans-ja_JP.ttf
popd

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}


%check
%{_bindir}/desktop-file-validate %{buildroot}/%{_datadir}/applications/lincity-ng.desktop


%post
if [ -x %{_bindir}/update-desktop-database ] ; then
%{_bindir}/update-desktop-database %{_datadir}/applications
fi

%postun
if [ -x %{_bindir}/update-desktop-database ] ; then
%{_bindir}/update-desktop-database %{_datadir}/applications
fi


%files
%defattr(-,root,root)
%doc %{_datadir}/doc/%{name}-%{version}
%{_bindir}/lincity-ng
%{_datadir}/pixmaps/*
%{_datadir}/applications/lincity-ng.desktop
%{_datadir}/lincity-ng

%changelog
* Tue Jan 24 2012 Munehiro Yamamoto <munepi@vinelinux.org> 2.0-5
- rebuild

* Mon Sep 20 2010 IWAI, Masaharu <iwai@alib.jp> 2.0-4
- build with SDL_gfx 2.0.22
- add BuildRequires: mesa-libGLU-devel
- validating desktop file in %%check section
- add %%post and %%postun sections for desktop file
 - add BuildRequires: desktop-file-utils

* Thu Jul 30 2009 Munehiro Yamamoto <munepi@vinelinux.org> 2.0-3
- added Japanese Summary and description

* Fri May 08 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.0-2
- added Requires: TrueType-vlgothic
- corrected symbolic link to sans-ja_JP.ttf

* Fri Mar 20 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0-1
- new upstream release.
- changed Group to Applications/Games

* Fri Oct 03 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.2-1vl5
- new upstream release.
- applied new versioning policy

* Wed Jan 02 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.1-0vl2
- rebuilt for VineSeed

* Thu Sep 06 2007 Atsushi SHICHI <ats777@gmail.com> 1.1.1-0vl1
- new upstream release.
- update Source:.
- add "BuildRequires: XOrg-gl-devel".

* Mon Sep 3 2007 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 1.1.0-0vl1
- initial build for Vine Linux 4.1
- add BuildRequires: vorbis-tools to convert the sounds

* Sun Dec 11 2005 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 1.0.2-0vlmp1
- minor version up

* Sun Jul 24 2005 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 1.0.1-0vlmp1
- minor version up

* Fri Jun 24 2005 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 1.0-0vlmp1
- initial build for Vine Linux 3.2


# end of file
