File openttd.spec of Package openttd

# If we have a prerelease version we can define it here
#define prever RC3

Name:           openttd
Version:        1.0.2
Release:        1%{?dist}
Summary:        Transport system simulation game

Group:          Amusements/Games
License:        GPLv2
URL:            http://www.openttd.org
Source0:        http://binaries.openttd.org/releases/%{version}%{?prever:-%{prever}}/%{name}-%{version}%{?prever:-%{prever}}-source.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	gcc-c++, libstdc++-devel
BuildRequires:  desktop-file-utils, SDL-devel, libpng-devel, unzip, zlib-devel
BuildRequires:  fontconfig-devel, libtimidity-devel, libicu-devel, lzo-devel
BuildRequires:  freetype-devel, ccache, doxygen
Requires:       hicolor-icon-theme, openttd-opengfx

%description
OpenTTD is modeled after a popular transportation business simulation game
by Chris Sawyer and enhances the game experience dramatically. Many features
were inspired by TTDPatch while others are original.


%package docs
Summary:        Documentation for OpenTTD
Group:          Documentation
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}

%description docs
Development documentation for OpenTTD. Includes information on how to program
the AI.

%prep
%setup -q -n %{name}-%{version}%{?prever:-%{prever}}


%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
# not using the configure macro since this isn't really autotools so it
# doesn't eat all the argument rpm passes when using the configure
# macro
./configure \
        --disable-strip \
        --prefix-dir= \
        --binary-dir=%{_bindir} \
        --data-dir=%{_datadir}/%{name} \
        --icon-dir=%{_datadir}/pixmaps \
        --icon-theme-dir=%{_datadir}/icons/hicolor \
        --man-dir=%{_mandir}/man6 \
        --menu-dir=%{_datadir}/applications \
        --without-shared-dir \
        --doc-dir=%{_docdir} \
        --install-dir=$RPM_BUILD_ROOT \
        --with-ccache
make %{?_smp_mflags} VERBOSE=1
# generate the AI API docs
cd src/ai/api
doxygen


%install
rm -rf $RPM_BUILD_ROOT
make install VERBOSE=1

# Remove the installed docs - we will install subset of those
rm -rf $RPM_BUILD_ROOT%{_docdir}

# install documentation
install -dpm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/docs/
cp -r docs/* $RPM_BUILD_ROOT%{_datadir}/%{name}/docs/

# Patch generated desktop file, as desktop-file-install doesn't know 1.1 format yet
sed -i 's/Version=1.1/Version=1.0/' media/openttd.desktop
desktop-file-install --dir=$RPM_BUILD_ROOT%{_datadir}/applications \
        --add-category=StrategyGame \
        media/openttd.desktop


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files
%defattr(-,root,root,-)
%doc COPYING changelog.txt known-bugs.txt readme.txt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man6/%{name}.6*
%{_datadir}/%{name}
%{_datadir}/pixmaps/%{name}.32.xpm
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%exclude %{_datadir}/%{name}/docs

%files docs
%defattr(-,root,root,-)
# These are really devel docs, but as we don't have -devel subpackage, we put it here
# Could be useful for people making graphics, AI scripts or translations
%{_datadir}/%{name}/docs/


%changelog
* Sun Jun 20 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.2-1
- update to 1.0.2
- contains bugfixes and translation updates

* Sat May 01 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.1-1
- update to 1.0.1
- fixes CVE-2010-0401, CVE-2010-0402, CVE-2010-0406

* Thu Apr 01 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-1
- update to final release

* Thu Mar 18 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-0.6.RC3
- update to RC3

* Thu Mar 04 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-0.5.RC2
- 1.0.0-RC2 bugfix release

* Wed Feb 24 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-0.4.RC1
- update to RC1

* Fri Feb 05 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-0.3.beta4
- 1.0.0-beta4

* Thu Jan 21 2010 Felix Kaechele <heffer@fedoraproject.org> - 1.0.0-0.2.beta3
- 1.0.0-beta3

* Sat Jan 16 2010 Felix Kaechele <heffer@fedoraproject.org>
- 1.0.0-beta2

* Sat Jan 02 2010 Felix Kaechele <heffer@fedoraproject.org> - 0.7.5-1
- 0.7.5 stable release
- fixes CVE-2009-4007

* Thu Dec 17 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.5-0.1.rc1
- bump to 0.7.5-RC1
- omitting 0.7.4 because it has a bug

* Sat Oct 10 2009 Alexey Torkhov <atorkhov@gmail.com> - 0.7.3-1
- New upstream release 0.7.3

* Sun Aug 23 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.2-1
- new upstream release 0.7.2

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

* Fri Jun 12 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.1-1
- upstream 0.7.1

* Sun May 31 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.1-0.4.rc2
- disable allegro due to performance problems

* Fri May 29 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.1-0.3.rc2
- updated icon cache scriptlets

* Thu May 28 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.1-0.2.rc2
- 0.7.1-RC2
- build docs from source

* Sat May 16 2009 Felix Kaechele <heffer@fedoraproject.org> - 0.7.1-0.1.rc1
- updated to 0.7.1-RC1

* Sat Apr 11 2009 Felix Kaechele <felix at fetzig dot org> - 0.7.0-1
- upstream 0.7.0
- added docs subpackage

* Sun Mar 29 2009 Felix Kaechele <felix at fetzig dot org> - 0.7.0-0.3.rc2
- 0.7.0-RC2
- dropped Patch0 since this does not reflect the behaviour that is intended
  by upstream. See http://bugs.openttd.org/task/2756

* Sat Mar 21 2009 Felix Kaechele <felix at fetzig dot org> - 0.7.0-0.2.rc1
- updated to RC1
- removed all references to possible trademarks
- added patch to ignore a missing sample.cat

* Mon Mar 09 2009 Alexey Torkhov <atorkhov@gmail.com> - 0.7.0-0.1.beta1
- Doing big cleanup of package:
- Dropping subpackages
- Drop .desktop sources in favour of one bundled
- Drop server menu entry - one can start server from game menu
- Drop suspicious data_patch (what was it needed for?)
- Cleanup macro usage
- Drop version from freetype build dep
- Correcting dirs in configure call: icons paths, disable duplicate shared dir,
  correct doc dir

- And adding few improvements:
- Using VERBOSE when doing make
- Adding libicu to build requires
- Add icons theme require
- Drop installation instructions from docs
- Use ccache (should speedup the local and mock builds)
- Change source url to canonical one

* Sun Jan 11 2009 Felix Kaechele <felix at fetzig dot org> - 0.6.3-3
- even more improvements made

* Sun Jan 11 2009 Felix Kaechele <felix at fetzig dot org> - 0.6.3-2
- incorporated suggestions made by reviewers

* Wed Dec 31 2008 Felix Kaechele <felix at fetzig dot org> - 0.6.3-1
- Initial build based on the SPEC by Peter Hanecak (http://hany.sk/~hany/RPM/)