Blob Blame History Raw
Name:		vodovod
Version:	1.10
Release:	2%{?dist}
Summary:	A pipe connecting game

Group:		Amusements/Games
License:	GPLv2+
URL:		http://home.gna.org/vodovod/
Source:		http://download.gna.org/vodovod/%{name}-%{version}-src.tar.gz
Patch:		vodovod-1.10-gcc43.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	desktop-file-utils SDL-devel SDL_image-devel SDL_mixer-devel
BuildRequires:	ImageMagick

%description
A free cross-platform pipe connecting game. You get a limited number
of pipes on each level and need to combine them to lead the water from
the house at the top of the screen to the storage tank at the bottom.


%prep
%setup -q -n %{name}-%{version}-src
%patch -p1
# change hardcoded paths to datafiles so we can run the game from anywhere
sed -i -e "s:data:%{_datadir}/%{name}/data:" \
	allmenus.cpp game.cpp main.cpp map.cpp sutils.cpp


%build
make %{?_smp_mflags} CC="%{__cxx} %{optflags}"
# startup wrapper
# we need this because the game uses current directory for config
cat <<EOF > %{name}-wrapper.sh
#!/bin/sh
pushd "\$PWD"
if [ ! -e ~/.vodovod ]; then
	mkdir ~/.vodovod
fi
cd ~/.vodovod
vodovod
popd
EOF
# .desktop file 
cat <<EOF > %{name}.desktop
[Desktop Entry]
Name=Vodovod
GenericName=Logic Game
Comment=A pipe connecting game
Exec=vodovod-wrapper.sh
Icon=vodovod
Terminal=false
Type=Application
Categories=Game;LogicGame;
EOF


%install
rm -rf %{buildroot}
install -D -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -m 0755 %{name}-wrapper.sh %{buildroot}%{_bindir}/%{name}-wrapper.sh
mkdir -p -m 0755 %{buildroot}%{_datadir}/%{name}
cp -pr data %{buildroot}%{_datadir}/%{name}/
mkdir -p -m 0755 %{buildroot}%{_datadir}/icons/hicolor/32x32/apps
convert data/abicon.bmp %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/vodovod.xpm
desktop-file-install --vendor="fedora" \
	--dir=%{buildroot}%{_datadir}/applications %{name}.desktop


%clean
rm -rf %{buildroot}


%post
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

  
%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
	%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%doc CHANGES COPYING html
%{_bindir}/%{name}
%{_bindir}/%{name}-wrapper.sh
%{_datadir}/%{name}/
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/32x32/apps/%{name}.xpm



%changelog
* Mon Feb 04 2008 Karel Volny <kvolny@redhat.com> 1.10-2
- Some fixes as per bug #428973:
- Fixed summary
- Added gtk-update-icon-cache
- Added patch to compile with gcc 4.3
- Modified compiler flags

* Wed Jan 16 2008 Karel Volny <kvolny@redhat.com> 1.10-1
- Initial release