Blob Blame History Raw
Name:           xpilot-ng
Version:        4.7.2
Release:        8%{?dist}
Summary:        Multiplayer space arcade game

Group:          Amusements/Games
License:        GPL
URL:            http://xpilot.sourceforge.net
Source0:        http://dl.sourceforge.net/sourceforge/xpilot/xpilot-ng-%{version}.tar.gz
Source1:	xpilot-ng.png
Source2:	xpilot-ng-x11.desktop
Source3:	xpilot-ng-sdl.desktop
Source4:	xpilot-ng-server.init
Source5:        xpilot-ng.sysconfig
Source6:        xpilot-ng.logrotate
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  desktop-file-utils
BuildRequires:  expat-devel SDL_ttf-devel SDL_image-devel zlib-devel
# The following BR are not needed for FC-4
BuildRequires:  libXt-devel libGLU-devel libXxf86misc-devel

%description
A highly addictive, infinitely configurable multiplayer space
arcade game.  You pilot a spaceship around space, dodging
obstacles, shooting players and bots, collecting power-ups, and
causing general mayhem.

%package server
Summary: Server for hosting xpilot games
Group: Amusements/Games
Requires(post): /sbin/chkconfig
Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
Requires(pre):   fedora-usermgmt
Requires(postun): fedora-usermgmt
%description server
The xpilot server.  This allows you to host xpilot games on your
computer and develop new xpilot maps.  This is required if you
are playing alone, but not required if you are joining one of the
public xpilot games hosted on the internet.

%prep
%setup -q
pushd doc/man
iconv --from=ISO-8859-1 --to=UTF-8 xpilot-ng-server.man > xpilot-ng-server.man.new
mv xpilot-ng-server.man.new xpilot-ng-server.man
iconv --from=ISO-8859-1 --to=UTF-8 xpilot-ng-x11.man > xpilot-ng-x11.man.new
mv xpilot-ng-x11.man.new xpilot-ng-x11.man
popd

%build
CFLAGS="$RPM_OPT_FLAGS" %configure
make %{?_smp_mflags}

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

chmod a+x $RPM_BUILD_ROOT/%{_datadir}/%{name}/mapconvert.py

desktop-file-install --vendor fedora                            \
        --dir ${RPM_BUILD_ROOT}%{_datadir}/applications         \
        --add-category X-Fedora                                 \
        %{SOURCE2}
desktop-file-install --vendor fedora                            \
        --dir ${RPM_BUILD_ROOT}%{_datadir}/applications         \
        --add-category X-Fedora                                 \
        %{SOURCE3}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/

install -p -D -m 755 %{SOURCE4} $RPM_BUILD_ROOT/%{_initrddir}/%{name}-server

install -p -D -m 644 %{SOURCE5} \
    $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/%{name}-server

install -p -D -m 644 %{SOURCE6} \
    $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}-server

# Copy certain configuration files to /etc so that they can be properly managed
# as config files.
install -p -D -m 644 lib/defaults.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/defaults.txt
install -p -D -m 600 lib/password.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/password.txt

%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

%pre server
/usr/sbin/fedora-groupadd 25 -r xpilot &>/dev/null || :
/usr/sbin/fedora-useradd  25 -r -s /sbin/nologin -d /usr/share/xpilot-ng -M \
                            -c 'XPilot Server' -g xpilot xpilot >/dev/null || :

%post server
/sbin/chkconfig --add xpilot-ng-server

%preun server
if [ "$1" = "0" ]; then
    /sbin/service xpilot-ng-server stop > /dev/null 2>&1
    /sbin/chkconfig --del xpilot-ng-server
fi

%postun server
if [ "$1" -ge "1" ]; then
    /sbin/service xpilot-ng-server restart >/dev/null 2>&1
fi
test "$1" != 0 || /usr/sbin/fedora-userdel  xpilot &>/dev/null || :
test "$1" != 0 || /usr/sbin/fedora-groupdel xpilot &>/dev/null || :

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_bindir}/xpilot-ng-replay
%{_bindir}/xpilot-ng-sdl
%{_bindir}/xpilot-ng-x11
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/textures
%{_datadir}/%{name}/fonts
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/48x48/apps/*.png
%{_mandir}/man6/xpilot-ng-replay.6.gz
%{_mandir}/man6/xpilot-ng-sdl.6.gz
%{_mandir}/man6/xpilot-ng-x11.6.gz
%doc README COPYING

%files server
%defattr(-,root,root,-)
%{_bindir}/xpilot-ng-xp-mapedit
%{_bindir}/xpilot-ng-server
%{_initrddir}/xpilot-ng-server
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-server
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-server
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/defaults.txt
%{_datadir}/%{name}/password.txt
%{_datadir}/%{name}/robots.txt
%{_datadir}/%{name}/shipshapes.txt
%{_datadir}/%{name}/mapconvert.py
%{_datadir}/%{name}/maps
%dir %{_sysconfdir}/%{name}
%config(noreplace) %attr(0600,games,games) %{_sysconfdir}/%{name}/password.txt
%config(noreplace) %{_sysconfdir}/%{name}/defaults.txt
%{_mandir}/man6/xpilot-ng-server.6.gz
%{_mandir}/man6/xpilot-ng-xp-mapedit.6.gz
%doc README COPYING
#The following two entries need to be removed with FC-4
%ghost %{_datadir}/%{name}/mapconvert.pyc
%ghost %{_datadir}/%{name}/mapconvert.pyo

%changelog
* Tue Jul 11 2006 Wart <wart at kobold.org> 4.7.2-8
- Fix Requires: for the -server subpackage

* Wed Mar 1 2006 Wart <wart at kobold.org> 4.7.2-7
- Create an xpilot user for running the server daemon
- Fix typo in logrotate configuration file.

* Tue Feb 28 2006 Wart <wart at kobold.org> 4.7.2-6
- Added sysconfig and initrd files for starting xpilot server at boot time
- Add copies of customizable configuration files to /etc/xpilot
- More readable spacing in changelog
- Add missing ; in desktop file
- Added RPM_OPT_FLAGS to compile line

* Thu Feb 16 2006 Wart <wart at kobold.org> 4.7.2-5
- Rebuild for FC-5

* Mon Feb 6 2006 Wart <wart at kobold.org> 4.7.2-4
- Don't make duplicates of the doc files for the subpackage.
- Use version macro is source path
- Preserve timestamps when installing icons.

* Fri Feb 3 2006 Wart <wart at kobold.org> 4.7.2-3
- Add readme and license files to the server subpackage
- Set default file attributes for the server subpackage

* Fri Feb 3 2006 Wart <wart at kobold.org> 4.7.2-2
- Allow both packages to 0wn datadir/xpilot-ng
- Clean up non-utf8 man pages 

* Thu Feb 2 2006 Wart <wart at kobold.org> 4.7.2-1
- Initial submission to Fedora Extras