Blob Blame History Raw
# Copyright (c) 2007 oc2pus <toni@links2linux.de>
# Copyright (c) 2007 Hans de Goede <j.w.r.degoede@hhs.nl>
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.

Name:           8Kingdoms
Version:        1.1.0
Release:        4%{?dist}
Summary:        8 Kingdoms is a 3D turn-based fantasy strategic game
Group:          Amusements/Games
License:        GPL+
URL:            http://kralovstvi.sourceforge.net/
# This is:
# http://downloads.sourceforge.net/kralovstvi/%{name}-%{version}.tar.gz
# With external/extgl.h removed, as that contains parts of Windows gl.h and
# parts of a version of glext.h which falls under the "SGI Free Software
# License B", neither which are Free software.
Source0:        %{name}-%{version}.tar.gz
# This is a Free replacement file with the troublesome parts replaced with
# parts from Mesa's gl.h and from The Kronos Group glext.h .
Source1:        extgl.h
Source2:        %{name}.desktop
Source3:        %{name}.png
Patch0:         8Kingdoms-1.1.0-64bit.patch
Patch1:         8Kingdoms-1.1.0-locking.patch
Patch2:         8Kingdoms-1.1.0-crash.patch
Patch3:         8Kingdoms-1.1.0-gcc43.patch
Patch4:         8Kingdoms-1.1.0-divide-by-zero.patch
Patch5:         8Kingdoms-1.1.0-cvs-fixes.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  expat-devel SDL_mixer-devel tcl-devel desktop-file-utils
Requires:       hicolor-icon-theme opengl-games-utils

%description
8 Kingdoms is a 3D turn-based fantasy strategic game in which
players become kings, build their empires and conquer enemy
kingdoms.

Theme of the game 8 Kingdoms is inspirated by the world of fantasy.
Players play on a fully 3D hex map. They construct buildings,
recruit units including infantry, mounted units, mages, catapults
and finally they attack enemy or help allies. Units gain experiences
during the battle, each unit can get some abilities upgraded to be
stronger. Data are stored in XML and freely accessible - from
language versions to units' attributes, moreover map editor with
random map generator is included for comfortable map editing.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
cp -a %{SOURCE1} external
chmod -x doc/gui/gui_img1.png
# configure won't recognize --datadir ...
sed -i 's|games/8Kingdoms|share/8Kingdoms|g' configure


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
# And here we must explicitly set pkgdatadir despite our earlier sed!
make install DESTDIR=$RPM_BUILD_ROOT pkgdatadir=%{_datadir}/%{name}
ln -s opengl-game-wrapper.sh $RPM_BUILD_ROOT%{_bindir}/%{name}-wrapper

# below is the desktop file and icon stuff.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/96x96/apps
install -p -m 644 %{SOURCE3} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/96x96/apps


%clean
rm -rf $RPM_BUILD_ROOT


%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 AUTHORS ChangeLog COPYING README doc/*
%{_bindir}/%{name}*
%{_datadir}/%{name}
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/96x96/apps/%{name}.png


%changelog
* Fri Jan  4 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-4
- Fix divide by zero abort (bz 427485)
- Backport various fixes from CVS

* Thu Jan  3 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-3
- Fix compiling with gcc 4.3
- Fix crash undercertain conditions (bz 425799)

* Sun Dec  2 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-2
- Replace BuildRequires expat with expat-devel (oops)
- Add a patch which stops 8Kingdoms from hanging in certain cases
- Use opengl-games-utils wrapper to show error dialog when DRI is missing

* Sat Nov 24 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-1
- Adapted Packman specfile for Fedora

* Fri Aug 10 2007 Toni Graffy <toni@links2linux.de> - 1.1.0-0.pm.1
- initial build 1.1.0