Blob Blame History Raw
Name:           wesnoth
Version:        0.9.5
Release:        1%{?dist}
Summary:        Battle for Wesnoth, a fantasy turn-based strategy game

Group:          Amusements/Games
License:        GPL
URL:            http://www.wesnoth.org
Source0:        http://www.wesnoth.org/files/wesnoth-%{version}.tar.gz
Source1:        wesnothd.init
Source2:        wesnoth.sysconfig
Source3:        README.fedora
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  SDL-devel, SDL_image-devel, SDL_mixer-devel
BuildRequires:  SDL_ttf-devel, SDL_net-devel, freetype-devel
BuildRequires:  libpng-devel
BuildRequires:  desktop-file-utils, gettext

Requires:       /sbin/chkconfig

%description
%{summary}.

Battle for control of villages, using variety of units which have advantages
and disadvantages in different types of terrains and against different types
of attacks. Units gain experience and advance levels, and are carried over
from one scenario to the next campaign.


%package server
Summary:	%{summary}
Group:		Amusements/Games
Requires:	%{name} = %{version}-%{release}

%description server
This package contains the binaries for running a Wesnoth server
for multi-player games.


%package tools
Summary:	%{summary}
Group:		Amusements/Games
Requires:	%{name} = %{version}-%{release}

%description tools
This package contains the game editor and development tools.


%prep
%setup -q
cp %{SOURCE3} .


%build
%configure --disable-dependency-tracking \
    --with-localedir=%{_datadir}/locale \
    --enable-editor \
    --enable-tools \
    --enable-server \
    --with-fifodir=/var/run/wesnothd \
    --with-server-uid=$(id -u) \
    --with-server-gid=$(id -g) 
make %{?_smp_mflags}


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

desktop-file-install --dir $RPM_BUILD_ROOT/%{_datadir}/applications \
                     --mode="0644" --vendor fedora \
                     --add-category="X-Fedora" icons/%{name}.desktop
# add icon for menus
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pixmaps
install -m 644 images/%{name}-icon.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps

# arrange server package files
mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mv ${RPM_BUILD_ROOT}%{_bindir}/wesnothd ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}/var/run/wesnothd
touch ${RPM_BUILD_ROOT}/var/run/wesnothd/socket
install -Dpm 755 %{SOURCE1} \
    $RPM_BUILD_ROOT%{_initrddir}/wesnothd
install -Dpm 644 %{SOURCE2} \
    $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/wesnoth

%find_lang %{name}.\*
#/usr/lib/rpm/find-lang.sh $RPM_BUILD_ROOT %name --all-name

find $RPM_BUILD_ROOT -name ".cvs*" | xargs rm -f
find $RPM_BUILD_ROOT -name "CVS" | xargs rm -rf


%clean
rm -rf $RPM_BUILD_ROOT


%pre server
/usr/sbin/useradd -c "Wesnoth server" -s /sbin/nologin \
	-r -d /var/run/wesnothd wesnothd 2> /dev/null || :


%post server
/sbin/chkconfig --add wesnothd
if [ $1 -gt 1 ]; then
    %{_initrddir}/wesnothd try-restart >/dev/null || :
fi


%preun server
if [ $1 -eq 0 ]; then
    %{_initrddir}/wesnothd stop >/dev/null 2>&1 || :
    /sbin/chkconfig --del wesnothd
fi


%files -f %{name}.\*.lang
%defattr(-,root,root,-)
%doc COPYING changelog README copyright MANUAL* README.fedora
%{_bindir}/wesnoth
%{_datadir}/%{name}
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%{_mandir}/man6/wesnoth.6*
%{_mandir}/*/man6/wesnoth.6*

%files tools
%defattr(-,root,root,-)
%{_bindir}/wesnoth_editor
%{_bindir}/exploder
%{_bindir}/cutter
%{_bindir}/wmlxgettext
%{_mandir}/man6/wesnoth_editor.6*
%{_mandir}/*/man6/wesnoth_editor.6*

%files server
%defattr(-,root,root,-)
%config %{_initrddir}/wesnothd
%config(noreplace) %{_sysconfdir}/sysconfig/wesnoth
%{_sbindir}/wesnothd
%{_mandir}/man6/wesnothd.*
%{_mandir}/*/man6/wesnothd.*
%attr(0700,wesnothd,wesnothd) %dir /var/run/wesnothd/
%ghost /var/run/wesnothd/socket

%changelog
* Sat Aug 13 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 0.9.5-1
- update to 0.9.5

* Wed Jul 27 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 0.9.4-1
- update to 0.9.4

* Fri Jul  8 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 0.9.3-1
- update to 0.9.3

* Mon Jun 13 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 0.9.2-1
- update to 0.9.2
- BR libpng-devel is needed
- add initscript and scriptlets for -server package
- don't build campaign server (upstream suggestion)
- split off editor+tools into -tools sub-package
- install translations into system's locale directories
- merge Panu's changes:
  Sat Apr 16 2005 Panu Matilainen <pmatilai@welho.com> 0.9.0-1
- enable campaign server and tools
- split server to separate package
- add wesnothd user in server %%pre
- buildrequire gettext

* Thu May 26 2005 Jeremy Katz <katzj@redhat.com> - 0.8-5
- fix build on x86_64

* Sun May 22 2005 Jeremy Katz <katzj@redhat.com> - 0.8-4
- rebuild on all arches

* Fri Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt

* Fri Jul 09 2004 Panu Matilainen <pmatilai@welho.com> 0:0.8-0.fdr.2
- use upstream desktop file and icon

* Sat Jul 03 2004 Panu Matilainen <pmatilai@welho.com> 0:0.8-0.fdr.1
- update to 0.8

* Tue Mar 30 2004 Panu Matilainen <pmatilai@welho.com> 0:0.7-0.fdr.1
- update to 0.7

* Wed Dec 17 2003 Panu Matilainen <pmatilai@welho.com> 0:0.6.1-0.fdr.1
- update to 0.6.1

* Mon Dec 15 2003 Panu Matilainen <pmatilai@welho.com> 0:0.6-0.fdr.2
- update to bugfixed tarball of 0.6

* Fri Dec 12 2003 Panu Matilainen <pmatilai@welho.com> 0:0.6-0.fdr.1
- update to 0.6
- adapt to the new autoconf make system
- enable editor and server

* Tue Nov 11 2003 Panu Matilainen <pmatilai@welho.com> 0:0.5.1-0.fdr.1
- update to 0.5.1
- Fedora -> fedora in desktop file vendor

* Tue Nov 04 2003 Panu Matilainen <pmatilai@welho.com> 0:0.5-0.fdr.1
- Initial Fedora packaging.