Package xu4: Specfile

Group: Games/Other
# BEGIN SourceDeps(oneline):
BuildRequires: /usr/bin/desktop-file-install libSDL-devel
# END SourceDeps(oneline)
# see https://bugzilla.altlinux.org/show_bug.cgi?id=10382
%define _localstatedir %{_var}
%global svndate 20150221
%global svnrev 3087

Name:           xu4
Version:        1.1
Release:        alt2_0.36.%{svndate}svn%{svnrev}
Summary:        Ultima IV recreated
License:        GPLv2+
URL:            http://xu4.sourceforge.net/
# This was generated by running the xu4-svn-checkout.sh script
Source0:        xu4-%{svndate}svn.tar.xz
Source1:        xu4.sh
Source2:        xu4.autodlrc
Source3:        u4download.txt
Patch0:         xu4-1.0beta3-desktop.patch
Patch1:         xu4-1.1-format-security.patch
BuildRequires:  gcc-c++ libSDL_mixer-devel libxml2-devel
BuildRequires:  libicns-utils libpng-devel desktop-file-utils
Requires:       icon-theme-hicolor autodownloader
Provides:       bundled(minizip) = 0.15
Source44: import.info

%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
%patch1 -p1
if [ "%{_lib}" = "lib64" ]; then
  sed -i 's|/usr/lib|%{_libdir}|g' src/u4file.cpp
fi
cp %{SOURCE3} .


%build
pushd src
make DEBUGCXXFLAGS="%{optflags}" \
  bindir=%{_bindir} datadir=%{_datadir} libdir=%{_libdir} %{?_smp_mflags}
popd

# The apple icns file has a higher resolution icon, but still not 256x256.
pushd icons
icns2png -x xu4.icns
popd

%install
pushd src
# Note: make install DESTDIR=%%{buildroot}, doesn't work
%{makeinstall}
find %{buildroot}/%{_libdir}/u4 -name '*.xml' -o -name '*.dtd'|xargs chmod -x
popd
cp -p mid/*.it %{buildroot}/%{_libdir}/u4/music

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

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

mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps
install -p -m 655 icons/xu4_128x128x32.png \
     %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps/u4.png
rm -rf %{buildroot}/%{_datadir}/pixmaps


%files
%doc --no-dereference COPYING
%doc AUTHORS README doc/Algorithms.* doc/*FileFormats.txt
%doc doc/U4Notes.txt doc/tools.txt u4download.txt
%{_bindir}/u4*
%{_libdir}/u4
%{_datadir}/applications/u4.desktop
%{_datadir}/icons/hicolor/128x128/apps/u4.png


%changelog
* Wed Oct 10 2018 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.36.20150221svn3087
- update to new release by fcimport

* Fri May 25 2018 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.33.20150221svn3087
- update to new release by fcimport

* Wed Sep 27 2017 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.30.20150221svn3087
- update to new release by fcimport

* Thu Mar 16 2017 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.28.20150221svn3087
- update to new release by fcimport

* Mon Dec 19 2016 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.27.20150221svn3087
- update to new release by fcimport

* Wed Feb 17 2016 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.26.20150221svn3087
- update to new release by fcimport

* Mon Oct 19 2015 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.25.20150221svn3087
- update to new release by fcimport

* Wed Aug 27 2014 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.22.20120106svn2999
- update to new release by fcimport

* Tue Jul 01 2014 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.21.20120106svn2999
- update to new release by fcimport

* Mon Aug 12 2013 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.20.20120106svn2999
- update to new release by fcimport

* Mon Feb 11 2013 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.19.20120106svn2999
- update to new release by fcimport

* Thu Oct 11 2012 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 1.1-alt2_0.18.20120106svn2999.1
- Rebuilt with libpng15

* Fri Jul 27 2012 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.18.20120106svn2999
- update to new release by fcimport

* Fri Mar 02 2012 Igor Vlasenko <viy@altlinux.ru> 1.1-alt2_0.17.20120106svn2999
- rebuild with fixed sourcedep analyser (#27020)

* Wed Jan 11 2012 Igor Vlasenko <viy@altlinux.ru> 1.1-alt1_0.17.20120106svn2999
- update to new release by fcimport

* Mon Dec 19 2011 Igor Vlasenko <viy@altlinux.ru> 1.1-alt1_0.16.20111215svn2997
- update to new release by fcimport

* Wed Jul 20 2011 Igor Vlasenko <viy@altlinux.ru> 1.1-alt1_0.14.20110329svn2873
- initial release by fcimport

* Wed Feb 16 2011 Igor Vlasenko <viy@altlinux.ru> 1.1-alt1_0.12.20110124svn2792
- converted from Fedora by srpmconvert script