# Spec file to build RPM packages - shamefully ripped from Exult
# (but since they got our configure summary, that's just fair I guess)

%define ver         @VERSION@
%define rel         1
%define prefix      /usr
%define name        @PACKAGE@
%define bindir      %prefix/bin
%define datadir     %prefix/share
%define gamedatadir %prefix/share/adonthell

Summary: A 2D graphical RPG game.
Name: %name
Version: %ver
Release: %rel
License: GPL
Group: Amusements/Games
Source: http://freesoftware.fsf.org/download/adonthell/%{name}-%{ver}.tar.gz
URL: http://adonthell.linuxgames.com
BuildRoot: /tmp/adonthell
Prereq: /usr/bin/strip
Prefix: %prefix
Docdir: %{prefix}/doc

%description
A 2D, graphical, single player role playing game inspired by good old 
console RPGs from the SNES like Secret of Mana or Chrono Trigger. 

This package contains the Adonthell engine. You will also need a game
package to play Adonthell. For this release, the official package is 
Waste's Edge.

%prep
%setup

%build
if [ ! -f configure ]; then
  ./autogen.sh
fi
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --bindir=%bindir --datadir=%datadir
make

%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{prefix} bindir=$RPM_BUILD_ROOT%{bindir} gamedatadir=$RPM_BUILD_ROOT%{gamedatadir} install
strip $RPM_BUILD_ROOT%{bindir}/adonthell
install -m 644 src/modules/adonthell.py $RPM_BUILD_ROOT%{gamedatadir}/modules/adonthell.py
install -m 644 src/modules/dialogue.py $RPM_BUILD_ROOT%{gamedatadir}/modules/dialogue.py



%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc ABOUT-NLS ChangeLog COPYING NEWS FULLSCREEN.howto README
%{bindir}/adonthell
%{gamedatadir}/modules/adonthell.py
%{gamedatadir}/modules/dialogue.py
