Blob Blame Raw
%define cvsdate 20070510

Name:           xu4
Version:        1.1
Release:        0.1.%{cvsdate}%{?dist}
Summary:        Ultima IV recreated
Group:          Amusements/Games
License:        GPL
URL:            http://xu4.sourceforge.net/
# This was generated as follows:
# cvs -d:pserver:anonymous@xu4.cvs.sourceforge.net:/cvsroot/xu4 login
# cvs -z3 -d:pserver:anonymous@xu4.cvs.sourceforge.net:/cvsroot/xu4 co -P u4
# rm -r `find u4 -name CVS`
# rm `find u4 -name .cvsignore`
# rm -r u4/vc6
# tar cvfz xu4-%{cvsdate}.tar.gz u4
Source0:        xu4-%{cvsdate}.tar.gz
Source1:        xu4.sh
Source2:        xu4.autodlrc
Source3:        u4download.txt
Patch0:         xu4-zipfile.patch
Patch1:         xu4-1.0beta3-desktop.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  SDL_mixer-devel libxml2-devel libpng-devel desktop-file-utils
Requires:       hicolor-icon-theme autodownloader

%description
XU4 is a remake of the computer game Ultima IV. This game requires the
original Ultima IV datafiles, which can be freely downloaded from the internet
but may not be (re)distributed. When you start xu4 for the first time it will
offer to download the datafiles for you.

XU4 isn't a new game based on the Ultima IV story -- it is a faithful
recreation of the old game, right up to the crappy graphics.  If you
are looking for a game with modern gameplay and graphics, this is not
it -- yet.  New features that improve the gameplay and keep with the
spirit of the original game will be added.


%prep
%setup -q -n u4
%patch0 -p1 -z .zipfile
%patch1 -p1 -z .desktop
if [ "%{_lib}" = "lib64" ]; then
  sed -i 's|/usr/lib|%{_libdir}|g' src/u4file.cpp
fi
cp %{SOURCE3} .


%build
pushd src
make DEBUGCXXFLAGS="$RPM_OPT_FLAGS" \
  bindir=%{_bindir} datadir=%{_datadir} libdir=%{_libdir}
popd


%install
rm -rf $RPM_BUILD_ROOT
pushd src
# Note: make install DESTDIR=$RPM_BUILD_ROOT, doesn't work
%{makeinstall}
find $RPM_BUILD_ROOT%{_libdir}/u4 -name '*.xml' -o -name '*.dtd'|xargs chmod -x
popd

# mv u4 to u4.bin and install our autodl wrapper script
mv $RPM_BUILD_ROOT%{_bindir}/u4 $RPM_BUILD_ROOT%{_bindir}/u4.bin
install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/u4
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_libdir}/u4

# below is the desktop file and icon stuff.
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --delete-original                             \
  $RPM_BUILD_ROOT%{_datadir}/applications/u4.desktop

mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps
mv $RPM_BUILD_ROOT%{_datadir}/pixmaps/u4.png \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :

%postun
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :


%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING README doc/Algorithms.* doc/*FileFormats.txt
%doc doc/U4Notes.txt doc/tools.txt u4download.txt
%{_bindir}/u4*
%{_libdir}/u4
%{_datadir}/pixmaps/u4.bmp
%{_datadir}/applications/fedora-u4.desktop
%{_datadir}/icons/hicolor/64x64/apps/u4.png


%changelog
* Fri May 11 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1-0.1.20070510
- Update to latest CVS, as this actually makes the game finishable
- Add missing BuildRequires: desktop-file-utils
- Add u4download.txt to the docs

* Thu Feb  1 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 1.0-0.1.beta3
- Initial Fedora Extras package