Handle invalid strings from game scripts more leniently
[openttd/fttd.git] / os / rpm / openttd.spec
blob91ffc8dfdcd2318ebe97c51394b20b91e8219bd9
2 # spec file for package openttd
4 # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
5 # Copyright (c) 2007-2012 The OpenTTD developers
7 # All modifications and additions to the file contributed by third parties
8 # remain the property of their copyright owners, unless otherwise agreed
9 # upon. The license for this file, and modifications and additions to the
10 # file, is the same license as for the pristine package itself (unless the
11 # license for the pristine package is not an Open Source License, in which
12 # case the license is the MIT License). An "Open Source License" is a
13 # license that conforms to the Open Source Definition (Version 1.9)
14 # published by the Open Source Initiative.
16 # Please submit bugfixes or comments via http://bugs.opensuse.org/
19 Name: openttd
20 Version: 1.3.beta2
21 Release: 0
22 %define srcver 1.3.0-beta2
23 Summary: An open source reimplementation of Chris Sawyer's Transport Tycoon Deluxe
24 License: GPL-2.0
25 Group: Amusements/Games/Strategy/Other
26 Url: http://www.openttd.org
28 Source: http://binaries.openttd.org/releases/%{srcver}/%{name}-%{srcver}-source.tar.gz
30 %if 0%{?suse_version} || 0%{?mdkversion}
31 Recommends: %{name}-gui
32 %endif
34 BuildRequires: gcc-c++
35 BuildRequires: libpng-devel
36 BuildRequires: zlib-devel
38 %if 0%{?suse_version} || 0%{?mdkversion}
39 BuildRequires: update-alternatives
40 Requires: update-alternatives
41 %else
42 BuildRequires: chkconfig
43 Requires: chkconfig
44 %endif
46 %if 0%{?mdkversion}
47 BuildRequires: liblzma-devel
48 BuildRequires: liblzo-devel
49 %else
50 BuildRequires: lzo-devel
51 BuildRequires: xz-devel
52 %endif
54 # OBS workaround: needed by libdrm
55 %if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
56 BuildRequires: kernel
57 %endif
59 # for lzma detection
60 %if 0%{?suse_version}
61 BuildRequires: pkg-config
62 %endif
64 # bulding openttd.grf is not required as it is a) part of source and
65 # b) required only, if you want to use the original set
66 %if 0%{?with_grfcodec}
67 BuildRequires: grfcodec
68 %endif
69 # Recommends would fit better but not well supported...
70 Requires: openttd-opengfx >= 0.4.2
72 Obsoletes: %{name}-data < %{version}
73 Provides: %{name}-data = %{version}
75 BuildRoot: %{_tmppath}/%{name}-%{version}-build
77 %description
78 OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
79 with lots of new features and enhancements. To play the game you need either
80 the original data from the game or install the recommend subackages OpenGFX for
81 free graphics, OpenSFX for free sounds and OpenMSX for free music.
83 OpenTTD is licensed under the GNU General Public License version 2.0. For more
84 information, see the file 'COPYING' included with every release and source
85 download of the game.
87 %package gui
88 Summary: OpenTTD GUI/Client (requires SDL)
89 Group: Amusements/Games/Strategy/Other
91 Requires: %{name}
92 Conflicts: %{name}-dedicated
94 BuildRequires: SDL-devel
95 BuildRequires: fontconfig-devel
97 %if 0%{?rhel_version} != 600
98 BuildRequires: libicu-devel
99 %endif
100 %if 0%{?rhel_version} || 0%{?fedora}
101 BuildRequires: freetype-devel
102 %endif
103 %if 0%{?suse_version} || 0%{?mdkversion}
104 BuildRequires: freetype2-devel
105 %endif
106 %if 0%{?suse_version}
107 BuildRequires: update-desktop-files
108 %else
109 BuildRequires: desktop-file-utils
110 Requires: hicolor-icon-theme
111 %endif
113 %if 0%{?suse_version} || 0%{?mdkversion}
114 Recommends: openttd-openmsx
115 Recommends: openttd-opensfx
116 %endif
118 %description gui
119 OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
120 with lots of new features and enhancements. To play the game you need either
121 the original data from the game or install the recommend subackages OpenGFX for
122 free graphics, OpenSFX for free sounds and OpenMSX for free music.
124 This subpackage provides the binary which needs SDL.
126 %package dedicated
127 Summary: OpenTTD Dedicated Server binary (without SDL)
128 Group: Amusements/Games/Strategy/Other
130 Requires: %{name}
131 Conflicts: %{name}-gui
133 %description dedicated
134 OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
135 with lots of new features and enhancements. To play the game you need either
136 the original data from the game or the required package OpenGFX and OpenSFX.
138 This subpackage provides the binary without dependency of SDL.
140 %prep
141 %setup -qn openttd%{?branch:-%{branch}}-%{srcver}
143 # we build the grfs from sources but validate the result with the existing data
144 %if 0%{?with_grfcodec}
145 md5sum bin/data/* > validate.data
146 %endif
148 %build
149 # first, we build the dedicated binary and copy it to dedicated/
150 ./configure \
151 --prefix-dir="%{_prefix}" \
152 --binary-dir="bin" \
153 --data-dir="share/%{name}" \
154 --enable-dedicated
155 make %{?_smp_mflags} BUNDLE_DIR="dedicated" bundle
157 # then, we build the common gui version which we install the usual way
158 ./configure \
159 --prefix-dir="%{_prefix}" \
160 --binary-name="%{name}" \
161 --binary-dir="bin" \
162 --data-dir="share/%{name}" \
163 --doc-dir="share/doc/%{name}" \
164 --menu-name="OpenTTD%{?branch: %{branch}}" \
165 --menu-group="Game;StrategyGame;"
167 make %{?_smp_mflags}
169 %install
170 # install the dedicated binary
171 install -D -m0755 dedicated/openttd %{buildroot}%{_bindir}/%{name}-dedicated
172 # install the gui binary and rename to openttd-gui
173 make install INSTALL_DIR=%{buildroot}
174 mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-gui
175 # we need a dummy target for /etc/alternatives/openttd
176 mkdir -p %{buildroot}%{_sysconfdir}/alternatives
177 touch %{buildroot}%{_sysconfdir}/alternatives/%{name}
178 ln -s -f /etc/alternatives/%{name} %{buildroot}%{_bindir}/%{name}
180 %if 0%{?suse_version}
181 %suse_update_desktop_file -r %{name} Game StrategyGame
182 %else
183 %if 0%{?fedora} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
184 desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
185 --add-category=StrategyGame \
186 media/openttd.desktop
187 %endif
188 %endif
190 %if 0%{?with_grfcodec}
191 %check
192 md5sum -c validate.data
193 %endif
195 %post gui
196 /usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-gui 10
197 touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
199 %post dedicated
200 /usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-dedicated 0
202 %preun gui
203 if [ "$1" = 0 ] ; then
204 /usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-gui
207 %preun dedicated
208 if [ "$1" = 0 ] ; then
209 /usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-dedicated
212 %postun gui
213 if [ "$1" -eq 0 ] ; then
214 touch --no-create %{_datadir}/icons/hicolor &>/dev/null
215 gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
218 %posttrans gui
219 gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
221 # we need a file in the main package so it will be made
222 %files
223 %defattr(-, root, root)
224 %dir %{_datadir}/doc/%{name}
225 %dir %{_datadir}/%{name}
226 %dir %{_datadir}/%{name}/lang
227 %dir %{_datadir}/%{name}/baseset
228 %dir %{_datadir}/%{name}/scripts
229 %dir %{_datadir}/%{name}/ai
230 %dir %{_datadir}/%{name}/game
231 %{_datadir}/doc/%{name}/*
232 %{_datadir}/%{name}/lang/*
233 %{_datadir}/%{name}/baseset/*
234 %{_datadir}/%{name}/scripts/*
235 %{_datadir}/%{name}/ai/*
236 %{_datadir}/%{name}/game/*
237 %doc %{_mandir}/man6/%{name}.6.*
239 %files gui
240 %defattr(-, root, root)
241 %ghost %{_sysconfdir}/alternatives/%{name}
242 %ghost %{_bindir}/%{name}
243 %{_bindir}/%{name}-gui
244 %dir %{_datadir}/icons/hicolor
245 %dir %{_datadir}/icons/hicolor/16x16
246 %dir %{_datadir}/icons/hicolor/16x16/apps
247 %dir %{_datadir}/icons/hicolor/32x32
248 %dir %{_datadir}/icons/hicolor/32x32/apps
249 %dir %{_datadir}/icons/hicolor/48x48
250 %dir %{_datadir}/icons/hicolor/48x48/apps
251 %dir %{_datadir}/icons/hicolor/64x64
252 %dir %{_datadir}/icons/hicolor/64x64/apps
253 %dir %{_datadir}/icons/hicolor/128x128
254 %dir %{_datadir}/icons/hicolor/128x128/apps
255 %dir %{_datadir}/icons/hicolor/256x256
256 %dir %{_datadir}/icons/hicolor/256x256/apps
257 %{_datadir}/applications/%{name}.desktop
258 %{_datadir}/icons/hicolor/16x16/apps/%{name}.png
259 %{_datadir}/icons/hicolor/32x32/apps/%{name}.png
260 %{_datadir}/icons/hicolor/48x48/apps/%{name}.png
261 %{_datadir}/icons/hicolor/64x64/apps/%{name}.png
262 %{_datadir}/icons/hicolor/128x128/apps/%{name}.png
263 %{_datadir}/icons/hicolor/256x256/apps/%{name}.png
264 %{_datadir}/pixmaps/%{name}.32.xpm
266 %files dedicated
267 %defattr(-, root, root)
268 %ghost %{_bindir}/%{name}
269 %ghost %{_sysconfdir}/alternatives/%{name}
270 %{_bindir}/%{name}-dedicated
272 %changelog