Blob Blame History Raw
Name:           liquidwar
Version:        5.6.4
Release:        6%{?dist}
Summary:        Multiplayer wargame with liquid armies
Group:          Amusements/Games
License:        GPLv2+
URL:            http://www.ufoot.org/liquidwar/v5
Source0:        http://download.savannah.nongnu.org/releases/%{name}/%{name}-%{version}.tar.gz
Source1:        liquidwar.init 
Source2:        liquidwar.sysconfig 
Source3:        liquidwar.logrotate 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  allegro-devel allegro-tools tetex-latex python texinfo
BuildRequires:  desktop-file-utils
Requires:       hicolor-icon-theme
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info

%description
Liquid War is a unique multiplayer wargame. You control an army of liquid
and have to try and eat your opponents. A single player mode is available,
but the game is definitely designed to be multiplayer, and has network
support. 


%package doc
Summary:        Documentation for the LiquidWar game in additional formats
Group:          Documentation
Requires:       %{name} = %{version}-%{release}

%description doc
This package contains the documentation of LiquidWar in html, pdf, ps and txt
format.


%package server
Summary:        Network game server for the LiquidWar game
Group:          Amusements/Games
Requires:       %{name} = %{version}-%{release}
Requires(pre):  /usr/sbin/useradd
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig /sbin/service
Requires(postun): /sbin/service

%description server
This package contains the server for hosting network LiquidWar games.


%prep
%setup -q
# don't strip the binaries please 
sed -i 's/install\(\s\+-c\)\?\s\+-s/install/g' Makefile.in
# fix manpage doc reference
sed -i \
  -e 's:^\.B /usr/share/doc/liquidwar $:\.B %{_docdir}/%{name}-doc-%{version}:' \
  -e 's:^or $:directory (from :' \
  -e 's:^\.B /usr/local/share/doc/liquidwar$:the %{name}-doc :' \
  -e 's:^directories, :package), :' \
  doc/man/begin.man.in
# fix README.* encoding
for i in de dk fr; do
  iconv -f ISO-8859-1 -t UTF8 README.$i > $i
  mv $i README.$i
done


%build
%configure --disable-target-opt \
%ifnarch %{ix86}
  --disable-asm
%endif

MAKE_FLAGS="DEBUG_FLAGS= GAMEDIR=%{_bindir} DATADIR=%{_datadir}/%{name}"
# to show to compile flags with out MAKE_FLAGS
make config $MAKE_FLAGS
make %{?_smp_mflags} $MAKE_FLAGS

# make docs utf-8
iconv -f ISO-8859-1 -t UTF8 doc/man/%{name}.6 | gzip > doc/man/%{name}.6.gz
gzip -cd doc/info/%{name}.info.gz | \
  iconv -f ISO-8859-1 -t UTF8 > doc/info/%{name}.info
gzip -f doc/info/%{name}.info


%install
rm -rf $RPM_BUILD_ROOT
make install_nolink DESTDIR=$RPM_BUILD_ROOT GAMEDIR=%{_bindir} \
  DATADIR=%{_datadir}/%{name} 
mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} liquidwardocs
rm $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.xpm

# below is the desktop file and icon stuff.
desktop-file-install --delete-original --vendor fedora \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications        \
  --add-category StrategyGame                          \
  --remove-category Application                        \
  --remove-category ArcadeGame                         \
  $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{32x32,48x48}/apps
install -p -m 644 misc/%{name}_32x32.xpm \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.xpm
install -p -m 644 misc/%{name}.xpm \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.xpm

install -p -D -m 755 %{SOURCE1} \
        $RPM_BUILD_ROOT/%{_initrddir}/%{name}-server
install -p -D -m 644 %{SOURCE2} \
        $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/%{name}-server
install -p -D -m 644 %{SOURCE3} \
        $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}-server


%clean
rm -rf $RPM_BUILD_ROOT


%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%preun
if [ $1 = 0 ]; then
    /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
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


%pre server
user_uid=`id -u %{name} 2>/dev/null`
if [ x"$user_uid" = x ] ; then
    /usr/sbin/useradd -r -s /sbin/nologin -d %{_datadir}/%{name} -M \
            -c 'LiquidWar Server' \
            %{name} >/dev/null || :
fi

%post server
/sbin/chkconfig --add %{name}-server

%preun server
if [ "$1" -le "0" ]; then
    /sbin/service %{name}-server stop > /dev/null 2>&1
    /sbin/chkconfig --del %{name}-server
fi

%postun server
if [ "$1" -ge "1" ]; then
    /sbin/service %{name}-server condrestart > /dev/null 2>&1
fi


%files
%defattr(-,root,root,-)
%doc COPYING README
%{_bindir}/%{name}
%{_bindir}/%{name}-mapgen
%{_datadir}/%{name}
%{_infodir}/%{name}.*
%{_mandir}/man6/%{name}.6.gz
%{_mandir}/man6/%{name}-mapgen.6.gz
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.xpm

%files doc
%defattr(-,root,root,-)
%doc liquidwardocs/*

%files server
%{_bindir}/%{name}-server
%{_mandir}/man6/%{name}-server.6.gz
%{_initrddir}/%{name}-server
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-server
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-server


%changelog
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.6.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.6.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Tue Apr  1 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.4-4
- Add missing BuildRequires:  desktop-file-utils

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 5.6.4-3
- Autorebuild for GCC 4.3

* Wed Dec 12 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.4-2
- Fix generation of debuginfo package (bz 413081) 
- Fix encoding of README.* files

* Mon Oct 22 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.4-1
- New upstream release 5.6.4

* Mon Aug 13 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.3-4
- Update License tag for new Licensing Guidelines compliance

* Sat Mar 10 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.3-3
- Fixup .desktop file categories for games-menus usage

* Thu Nov 23 2006 Wart <wart@kobold.org> 5.6.3-2
- Added init.d startup and logrotate scripts for the game server
- Put the game server in its own subpackage

* Sun Nov 19 2006 Hans de Goede <j.w.r.degoede@hhs.nl> 5.6.3-1
- Initial Fedora Extras package