1
0
Fork 0

(svn r23923) -Update [FS#5044]: rpm specs (Ammler)

release/1.2
rubidium 2012-02-11 19:25:53 +00:00
parent 50a6f1a2f7
commit 445d12b6e5
1 changed files with 184 additions and 111 deletions

View File

@ -1,40 +1,58 @@
%define dedicated 0 #
# spec file for package openttd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007-2012 The OpenTTD developers
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
%define binname openttd # Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define srcver 1.2.0 Name: openttd
Version: 1.2.beta4
%if %{dedicated} Release: 0
Name: %{binname}-dedicated %define srcver 1.2.0-beta4
%else Summary: An open source reimplementation of Chris Sawyer's Transport Tycoon Deluxe
Name: %{binname} License: GPL-2.0
%endif
Version: %{srcver}
Release: 1%{?dist}
Group: Amusements/Games/Strategy/Other Group: Amusements/Games/Strategy/Other
License: GPLv2 Url: http://www.openttd.org
URL: http://www.openttd.org
Summary: An open source clone of Chris Sawyer's Transport Tycoon Deluxe
Source: openttd%{?branch:-%{branch}}-%{srcver}-source.tar.bz2 Source: http://binaries.openttd.org/releases/%{srcver}/%{name}-%{srcver}-source.tar.gz
# the main package works with the exact same data package version only %if 0%{?suse_version} || 0%{?mdkversion}
Requires: %{binname}-data = %{version} Recommends: %{name}-gui
%endif
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: libpng-devel BuildRequires: libpng-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
%if 0%{?suse_version} || 0%{?mdkversion}
BuildRequires: update-alternatives
Requires: update-alternatives
%else
BuildRequires: chkconfig
Requires: chkconfig
%endif
%if 0%{?mdkversion} %if 0%{?mdkversion}
BuildRequires: liblzo-devel
BuildRequires: liblzma-devel BuildRequires: liblzma-devel
BuildRequires: liblzo-devel
%else %else
BuildRequires: lzo-devel BuildRequires: lzo-devel
BuildRequires: xz-devel BuildRequires: xz-devel
%endif %endif
#needed by libdrm # OBS workaround: needed by libdrm
%if 0%{?rhel_version} >= 600 %if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
BuildRequires: kernel BuildRequires: kernel
%endif %endif
@ -43,44 +61,18 @@ BuildRequires: kernel
BuildRequires: pkg-config BuildRequires: pkg-config
%endif %endif
# Desktop specific tags, not needed for dedicated # bulding openttd.grf is not required as it is a) part of source and
%if !%{dedicated} # b) required only, if you want to use the original set
BuildRequires: fontconfig-devel %if 0%{?with_grfcodec}
BuildRequires: SDL-devel
BuildRequires: grfcodec BuildRequires: grfcodec
# vendor specific dependencies
%if !0%{?rhel_version}
BuildRequires: libicu-devel
%endif
%if 0%{?rhel_version} || 0%{?fedora}
BuildRequires: freetype-devel
%endif
%if 0%{?suse_version} || 0%{?mdkversion}
BuildRequires: freetype2-devel
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
%endif
%if %{dedicated}
Conflicts: %{binname} %{binname}-gui
%else
Provides: %{binname}-gui
Conflicts: %{binname}-dedicated
Requires: openttd-opensfx
# recommends works for suse (not sles9) and mandriva, only
%if 0%{?suse_version} || 0%{?mdkversion}
# require timidity is part of openmsx
Recommends: openttd-openmsx
%endif
%endif %endif
# Recommends would fit better but not well supported... # Recommends would fit better but not well supported...
Requires: openttd-opengfx >= 0.3.2 Requires: openttd-opengfx >= 0.4.2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Obsoletes: %{name}-data < %{version}
Provides: %{name}-data = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe" OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
@ -92,70 +84,161 @@ OpenTTD is licensed under the GNU General Public License version 2.0. For more
information, see the file 'COPYING' included with every release and source information, see the file 'COPYING' included with every release and source
download of the game. download of the game.
# the subpackage data needs only to build once, the dedicated version %package gui
# can reuse the data package of the gui package Summary: OpenTTD GUI/Client (requires SDL)
%if !%{dedicated}
%package data
Summary: Data package for OpenTTD
Group: Amusements/Games/Strategy/Other Group: Amusements/Games/Strategy/Other
%if 0%{?suse_version} >= 1120 || 0%{?fedora} || 0%{?mdkversion}
BuildArch: noarch
%endif
BuildRequires: grfcodec
%description data Requires: %{name}
Conflicts: %{name}-dedicated
BuildRequires: SDL-devel
BuildRequires: fontconfig-devel
%if 0%{?rhel_version} != 600
BuildRequires: libicu-devel
%endif
%if 0%{?rhel_version} || 0%{?fedora}
BuildRequires: freetype-devel
%endif
%if 0%{?suse_version} || 0%{?mdkversion}
BuildRequires: freetype2-devel
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%else
BuildRequires: desktop-file-utils
Requires: hicolor-icon-theme
%endif
%if 0%{?suse_version} || 0%{?mdkversion}
Recommends: openttd-openmsx
Recommends: openttd-opensfx
%endif
%description gui
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need either
the original data from the game or install the recommend subackages OpenGFX for
free graphics, OpenSFX for free sounds and OpenMSX for free music.
This subpackage provides the binary which needs SDL.
%package dedicated
Summary: OpenTTD Dedicated Server binary (without SDL)
Group: Amusements/Games/Strategy/Other
Requires: %{name}
Conflicts: %{name}-gui
%description dedicated
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe" OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need either with lots of new features and enhancements. To play the game you need either
the original data from the game or the required package OpenGFX and OpenSFX. the original data from the game or the required package OpenGFX and OpenSFX.
This package is required by openttd gui and openttd dedicated package. This This subpackage provides the binary without dependency of SDL.
way it is possible to install a openttd version without SDL requirement.
%endif
%prep %prep
%setup -qn openttd%{?branch:-%{branch}}-%{srcver} %setup -qn openttd%{?branch:-%{branch}}-%{srcver}
# we build the grfs from sources but validate the result with the existing data # we build the grfs from sources but validate the result with the existing data
md5sum bin/baseset/* > validate.data %if 0%{?with_grfcodec}
md5sum bin/data/* > validate.data
%endif
%build %build
# first, we build the dedicated binary and copy it to dedicated/
./configure \ ./configure \
--prefix-dir="%{_prefix}" \ --prefix-dir="%{_prefix}" \
--binary-name="%{binname}" \
--binary-dir="bin" \ --binary-dir="bin" \
--data-dir="share/%{binname}" \ --data-dir="share/%{name}" \
--doc-dir="share/doc/%{binname}" \ --enable-dedicated
make %{?_smp_mflags} BUNDLE_DIR="dedicated" bundle
# then, we build the common gui version which we install the usual way
./configure \
--prefix-dir="%{_prefix}" \
--binary-name="%{name}" \
--binary-dir="bin" \
--data-dir="share/%{name}" \
--doc-dir="share/doc/%{name}" \
--menu-name="OpenTTD%{?branch: %{branch}}" \ --menu-name="OpenTTD%{?branch: %{branch}}" \
--menu-group="Game;StrategyGame;" \ --menu-group="Game;StrategyGame;"
--enable-dedicated="%{dedicated}" \
make %{?_smp_mflags} make %{?_smp_mflags}
%install %install
%if %{dedicated} # install the dedicated binary
# dedicated package needs binary only install -D -m0755 dedicated/openttd %{buildroot}%{_bindir}/%{name}-dedicated
install -D -m0755 bin/openttd %{buildroot}/%{_bindir}/%{binname} # install the gui binary and rename to openttd-gui
make install INSTALL_DIR=%{buildroot}
mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-gui
# we need a dummy target for /etc/alternatives/openttd
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/%{name}
ln -s -f /etc/alternatives/%{name} %{buildroot}%{_bindir}/%{name}
%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Game StrategyGame
%else %else
make install INSTALL_DIR="%{buildroot}" %if 0%{?fedora} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
%if 0%{?suse_version} desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
%suse_update_desktop_file -r %{binname} Game StrategyGame --add-category=StrategyGame \
%endif media/openttd.desktop
%endif
%endif %endif
%clean %if 0%{?with_grfcodec}
rm -rf "%{buildroot}"
%check %check
md5sum -c validate.data md5sum -c validate.data
%endif
%post gui
/usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-gui 10
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%post dedicated
/usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-dedicated 0
%preun gui
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-gui
fi
%preun dedicated
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-dedicated
fi
%postun gui
if [ "$1" -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans gui
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
# we need a file in the main package so it will be made
%files %files
%attr(755, root, root) %{_bindir}/%{binname}
# all other files are for the gui version only, also no
# subpackage needed for the dedicated version
%if !%{dedicated}
%defattr(-, root, root) %defattr(-, root, root)
%dir %{_datadir}/doc/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/lang
%dir %{_datadir}/%{name}/baseset
%dir %{_datadir}/%{name}/scripts
%dir %{_datadir}/%{name}/ai
%{_datadir}/doc/%{name}/*
%{_datadir}/%{name}/lang/*
%{_datadir}/%{name}/baseset/*
%{_datadir}/%{name}/scripts/*
%{_datadir}/%{name}/ai/*
%doc %{_mandir}/man6/%{name}.6.*
%files gui
%defattr(-, root, root)
%ghost %{_sysconfdir}/alternatives/%{name}
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}-gui
%dir %{_datadir}/icons/hicolor %dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/16x16 %dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/16x16/apps %dir %{_datadir}/icons/hicolor/16x16/apps
@ -169,29 +252,19 @@ md5sum -c validate.data
%dir %{_datadir}/icons/hicolor/128x128/apps %dir %{_datadir}/icons/hicolor/128x128/apps
%dir %{_datadir}/icons/hicolor/256x256 %dir %{_datadir}/icons/hicolor/256x256
%dir %{_datadir}/icons/hicolor/256x256/apps %dir %{_datadir}/icons/hicolor/256x256/apps
%{_datadir}/applications/%{binname}.desktop %{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/16x16/apps/%{binname}.png %{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%{_datadir}/icons/hicolor/32x32/apps/%{binname}.png %{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_datadir}/icons/hicolor/48x48/apps/%{binname}.png %{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/64x64/apps/%{binname}.png %{_datadir}/icons/hicolor/64x64/apps/%{name}.png
%{_datadir}/icons/hicolor/128x128/apps/%{binname}.png %{_datadir}/icons/hicolor/128x128/apps/%{name}.png
%{_datadir}/icons/hicolor/256x256/apps/%{binname}.png %{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/pixmaps/%{binname}.32.xpm %{_datadir}/pixmaps/%{name}.32.xpm
%files data %files dedicated
%defattr(-, root, root) %defattr(-, root, root)
%dir %{_datadir}/doc/%{binname} %ghost %{_bindir}/%{name}
%dir %{_datadir}/%{binname} %ghost %{_sysconfdir}/alternatives/%{name}
%dir %{_datadir}/%{binname}/lang %{_bindir}/%{name}-dedicated
%dir %{_datadir}/%{binname}/baseset
%dir %{_datadir}/%{binname}/scripts
%dir %{_datadir}/%{binname}/ai
%{_datadir}/doc/%{binname}/*
%{_datadir}/%{binname}/lang/*
%{_datadir}/%{binname}/baseset/*
%{_datadir}/%{binname}/scripts/*
%{_datadir}/%{binname}/ai/*
%doc %{_mandir}/man6/%{binname}.6.*
%endif
%changelog %changelog