summaryrefslogtreecommitdiff
path: root/openttd.spec
blob: 12ed4dbc0b9ebcb2a75eba4d5344e2a8da6a0d91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Name:           openttd
Version:        14.1
Release:        2
Summary:        Transport system simulation game

License:        GPL-2.0-only AND BSD-3-Clause AND LGPL-2.1-or-later AND MIT AND Zlib
URL:            https://www.openttd.org
Source0:        https://cdn.openttd.org/openttd-releases/%{version}/%{name}-%{version}-source.tar.xz
Patch0:         openttd-14.1-link-against-icu-uc.patch

BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  doxygen
BuildRequires:  fontconfig-devel
BuildRequires:  fluidsynth-devel
BuildRequires:  freetype-devel
BuildRequires:  gcc-c++
BuildRequires:  libicu-devel
BuildRequires:  libpng-devel
BuildRequires:  lzo-devel
BuildRequires:  SDL2-devel
BuildRequires:  xz-devel
BuildRequires:  zlib-devel

Requires:       hicolor-icon-theme

Recommends:     openttd-opengfx => 0.5.0
Recommends:     fluid-soundfont-gm

%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
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}

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


%prep
%autosetup -p1 -n %{name}-%{version}%{?prever:-%{prever}}

sed -i "s|/usr/share|%{_datadir}|g" src/music/fluidsynth.cpp

%build
mkdir build
cd build  
%cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_BINDIR=bin \
    -DCMAKE_INSTALL_DATADIR=%{_datadir} \
    -DGLOBAL_DIR:PATH=%{_datadir}/%{name} ..

%make_build

%install
cd build
%make_install

# 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 -a docs/* $RPM_BUILD_ROOT%{_datadir}/%{name}/docs/
# this is installed into the proper path earlier
#rm $RPM_BUILD_ROOT%{_datadir}/%{name}/docs/%{name}.6


desktop-file-install --dir=$RPM_BUILD_ROOT%{_datadir}/applications \
        --add-category=StrategyGame \
        $RPM_BUILD_ROOT%{_datadir}/applications/openttd.desktop

# Register as an application to be visible in the software center
#
# NOTE: It would be *awesome* if this file was maintained by the upstream
# project, translated and installed into the right place during `make install`.
#
# See http://www.freedesktop.org/software/appstream/docs/ for more details.
#
mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata
cat > $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Ankur Sinha <ankursinha@fedoraproject.org> -->
<!--
EmailAddress: alberth@openttd.org
SentUpstream: 2014-09-25
-->
<application>
  <id type="desktop">openttd.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <summary>A highly detailed transport simulation game</summary>
  <description>
  <p>
      OpenTTD is a transport tycoon simulation game that enhances the
      original Transport Tycoon game developed by Chris Sawyer.
      The game includes road, air, train and naval transport with a large
      selection of industries and passenger services that need to be provided.
    </p>
  <p>
      The game can be played in both single and multiplayer modes where
      you compete with other transport companies to dominate the markets.
  </p>
  </description>
  <url type="homepage">https://www.openttd.org</url>
  <screenshots>
    <screenshot type="default">https://www.openttd.org/screenshots/1.4-02-opengfx-1920x1200.png</screenshot>
    <screenshot>https://www.openttd.org/screenshots/1.9-darkuk-3.png</screenshot>
  </screenshots>
  <updatecontact>info@openttd.org</updatecontact>
</application>
EOF

%files
%license COPYING.md
%doc changelog.txt CONTRIBUTING.md CREDITS.md known-bugs.txt README.md
%{_bindir}/%{name}
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man6/%{name}.6*
%{_datadir}/%{name}
%{_datadir}/pixmaps/%{name}.32.xpm
%{_datadir}/pixmaps/%{name}.64.xpm
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%exclude %{_datadir}/%{name}/docs

%files docs
# 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
* Fri Nov 01 2024 Funda Wang <fundawang@yeah.net> - 14.1-2
- fix build with icu >= 76.1

* Tue Jul 16 2024 zhangxingrong-<zhangxingrong@uniontech.cn> - 14.1-1
- update to version 14.1

* Wed May 24 2023 wangtaozhi <wangtaozhi@kylinsec.com.cn> - 13.0-1
- Package init